NativeScript Lazy
A NativeScript module that provides an OOP version of the build-in lazy function.
NativeScript Toolbox
This module is part of nativescript-toolbox.
License
Platforms
- Android
- iOS
Installation
Run
tns plugin add nativescript-lazy
inside your app project to install the module.
Example
; ; // [1] (false)console.log'isValueCreated: ' + lazyValue.isValueCreated;// [2] current timeconsole.log'value: ' + lazyValue.value;// [3] (true)console.log'isValueCreated: ' + lazyValue.isValueCreated;// [4] same value from [2]console.log'value: ' + lazyValue.value; lazyValue.reset; // [5] (false)console.log'isValueCreated: ' + lazyValue.isValueCreated;// [6] (new) current timeconsole.log'value: ' + lazyValue.value;// [7] (true)console.log'isValueCreated: ' + lazyValue.isValueCreated;// [8] same value from [6]console.log'value: ' + lazyValue.value;