bind-methods:将对象中的所有方法绑定到自身或指定的上下文

时间:2021-04-29 00:03:18
【文件属性】:
文件名称:bind-methods:将对象中的所有方法绑定到自身或指定的上下文
文件大小:4KB
文件格式:ZIP
更新时间:2021-04-29 00:03:18
JavaScript 绑定方法 将对象中的所有方法绑定到自身或指定的上下文 安装 $ npm install bind-methods 用法 import bindMethods from 'bind-methods' ; const unicorn = { name : 'Rainbow' , message ( ) { return ` ${ this . name } is awesome!` ; } } ; const message = unicorn . message ; message ( ) ; //=> Error: Cannot read property 'name' of undefined bindMethods ( unicorn ) ; const message2 = unicorn . message ; message2 ( ) ; //=> 'Rainbow i
【文件预览】:
bind-methods-main
----index.js(241B)
----test.js(424B)
----package.json(715B)
----readme.md(883B)
----.github()
--------workflows()
----license(1KB)
----.gitignore(23B)
----.npmrc(19B)
----.editorconfig(175B)
----.gitattributes(19B)

网友评论