aboutsummaryrefslogtreecommitdiffstats
path: root/_libly.js
diff options
context:
space:
mode:
authoranekos2008-12-21 07:53:15 +0000
committeranekos2008-12-21 07:53:15 +0000
commit774083438c0c7e6b0e06b098d69e8076f6eac9e9 (patch)
tree4fa6205b87354e103071fcf9e3ab4a0e050c4074 /_libly.js
parent1b4bd6822ac573f4dfe3a0ff36171591003417cb (diff)
downloadvimperator-plugins-774083438c0c7e6b0e06b098d69e8076f6eac9e9.tar.bz2
Fix typo.
Add around. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@27151 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to '_libly.js')
-rw-r--r--_libly.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/_libly.js b/_libly.js
index deab57e..2db2756 100644
--- a/_libly.js
+++ b/_libly.js
@@ -2,10 +2,10 @@
var PLUGIN_INFO =
<VimperatorPlugin>
<name>libly(filename _libly.js)</name>
- <description>vimperator plugins library?</description>
+ <description>Vimperator plugins library?</description>
<description lang="ja">適当なライブラリっぽいものたち。</description>
<author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author>
- <version>0.1.12</version>
+ <version>0.1.13</version>
<minVersion>1.2</minVersion>
<maxVersion>2.0pre</maxVersion>
<updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/_libly.js</updateURL>
@@ -26,6 +26,14 @@ extend(dst, src):
オブジェクトを拡張します。
A(iterable):
オブジェクトを配列にします。
+around(obj, name, func):
+ obj がもつ name 関数を、func に置き換えます。
+ func は
+ function (next, args) {...}
+ という形で呼ばれます。
+ next はオリジナルの関数を呼び出すための関数、
+ args はオリジナルの引数列です。
+ next には引数を渡す必要はありません。
bind(obj, func):
func に obj を bind します。
func内からは this で obj が参照できるようになります。
@@ -36,7 +44,7 @@ evalJson(str, toRemove):
str を decode します。
toRemove が true の場合、文字列の前後を1文字削除します。
"(key:value)" 形式の場合などに true を指定して下さい。
-deteFormat(dtm, fmt):
+dateFormat(dtm, fmt):
Date型インスタンスを、指定されたフォーマットで文字列に変換します。
fmt を省略した場合、"%y/%M/%d %h:%m:%s" となります。
@@ -124,6 +132,14 @@ libly.$U = {//{{{
}
return ret;
},
+ around: function around (obj, name, func) {
+ let next = obj[name];
+ let current = obj[name] = function () {
+ let self = this, args = arguments;
+ return func.call(self, function () next.apply(self, args), args);
+ };
+ return [next, current];
+ },
bind: function(obj, func) {
return function() {
return func.apply(obj, arguments);