diff options
author | anekos | 2009-12-22 14:03:25 +0000 |
---|---|---|
committer | anekos | 2009-12-22 14:03:25 +0000 |
commit | 0ed5e680ddb01441bce15b6b2d0e19c60521f15a (patch) | |
tree | 8badbc14684e17fbd15aa733981ebaa91354b32c | |
parent | 4b2b98ea661c550ad263862c1ee3c3836987a69f (diff) | |
download | vimperator-plugins-0ed5e680ddb01441bce15b6b2d0e19c60521f15a.tar.bz2 |
around の返値を強化
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36238 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-x | _libly.js | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -12,7 +12,7 @@ var PLUGIN_INFO = <description lang="ja">適当なライブラリっぽいものたち。</description> <author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author> <license>MIT</license> - <version>0.1.28</version> + <version>0.1.29</version> <minVersion>2.3pre</minVersion> <maxVersion>2.3pre</maxVersion> <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/_libly.js</updateURL> @@ -43,6 +43,14 @@ around(obj, name, func): args はオリジナルの引数列です。 通常、next には引数を渡す必要はありません。 (任意の引数を渡したい場合は配列で渡します。) + 返値は以下のオブジェクトです + >|| + { + original: オリジナルの関数 + current: 現在の関数 + restore: 元に戻すための関数 + } + ||< bind(obj, func): func に obj を bind します。 func内からは this で obj が参照できるようになります。 @@ -230,7 +238,11 @@ libly.$U = {//{{{ let self = this, args = arguments; return func.call(self, function (_args) next.apply(self, _args || args), args); }; - return [next, current]; + return libly.$U.extend({ + original: next, + current: current, + restore: function () (obj[name] = next) + }, [next, current]); }, bind: function(obj, func) { return function() { |