【文件属性】:
文件名称:lazy-property:对象属性的延迟初始化
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-01 16:27:50
JavaScript
惰性
向对象添加延迟初始化的属性。
例子
var addLazyProperty = require ( "lazy-property" )
var obj = { }
addLazyProperty ( obj , "foo" , function ( ) {
console . log ( "initialized!" )
return "bar"
} )
//Access the property
console . log ( obj . foo )
console . log ( obj . foo )
//Prints out:
//
// initialized!
// bar
// bar
//
安装
npm install lazy-property
原料药
require("lazy-property")(obj, name, init[, e
【文件预览】:
lazy-property-master
----package.json(746B)
----test()
--------test.js(350B)
----component.json(177B)
----LICENSE(1KB)
----.npmignore(105B)
----.gitignore(107B)
----README.md(806B)
----lazyProperty.js(532B)