タグ

ECMAScriptに関するEhrenのブックマーク (22)

  • gist:360183

    gistfile1.js �/��� �bU��� (function(){ // ある関数について、最初に呼び出されたときと2回目以降で処理を分ける方法 // 自分自身を書き換える関数 // 初期化コストが低いが、見た目がイマイチ // 関数宣言でなくても良いが、関数宣言なら定義する場所を気にしなくて良くなる function A(){ A = _A; /*一回目の処理*/ // _A.apply(this,arguments);//2回目の処理を呼ぶこともOK function _A(){ /*2回目以降*/ } } // 無名関数を使う方が一般的 // 慣れるとわかりやすい。この処理が実行されるまでBは未定義なので、定義位置に注意 var B = (function () { var e = false; return function () { e = true; }; })()

    gist:360183
  • Plugins | jQuery Plugins

    jQuery AOP is a very small plugin that adds features of aspect-oriented programming (AOP) to jQuery. It allows to add advices (Before, After, Around and Introduction) to any global or instance object. Features Allows to add Before, After,Around and Introduction advices. Allows to define point-cuts using regex to match multiple methods. Works with global function and object methods. Advices can be