【文件属性】:
文件名称:bind:函数绑定实用程序
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-17 00:35:16
JavaScript
绑定
函数绑定实用程序。
安装
$ component install component/bind
应用程序接口
绑定(对象,fn)
应该将函数绑定到给定的对象。
var tobi = { name : 'tobi' } ;
function name ( ) {
return this . name ;
}
var fn = bind ( tobi , name ) ;
fn ( ) . should . equal ( 'tobi' ) ;
绑定(对象,fn,...)
应该咖喱剩下的论点。
function add ( a , b ) {
return a + b ;
}
bind ( null , add ) ( 1 , 2 ) . should . equal ( 3 ) ;
bind ( null , add , 1 ) ( 2 ) . should .
【文件预览】:
bind-master
----.gitignore(13B)
----package.json(401B)
----Makefile(89B)
----History.md(278B)
----LICENSE(1KB)
----index.js(474B)
----Readme.md(983B)
----component.json(192B)
----.npmignore(29B)
----test()
--------bind.js(1KB)