Add most of components and prepare for V1 Release
This commit is contained in:
16
src/utils/lazyValue.js
Normal file
16
src/utils/lazyValue.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// This piece of code was orignally written by sindresorhus and can be seen here
|
||||
// https://github.com/sindresorhus/lazy-value/blob/master/index.js
|
||||
|
||||
export default fn => {
|
||||
let called = false
|
||||
let ret
|
||||
|
||||
return () => {
|
||||
if (!called) {
|
||||
called = true
|
||||
ret = fn()
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user