nativescript-lazy
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

npm npm

NativeScript Lazy

A NativeScript module that provides an OOP version of the build-in lazy function.

Donate

NativeScript Toolbox

This module is part of nativescript-toolbox.

License

MIT license

Platforms

  • Android
  • iOS

Installation

Run

tns plugin add nativescript-lazy

inside your app project to install the module.

Example

import { Lazy } from 'nativescript-lazy';
 
var lazyValue = new Lazy<Date>(() => new Date());
 
// [1] (false)
console.log('isValueCreated: ' + lazyValue.isValueCreated);
// [2] current time
console.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 time
console.log('value: ' + lazyValue.value);
// [7] (true)
console.log('isValueCreated: ' + lazyValue.isValueCreated);
// [8] same value from [6]
console.log('value: ' + lazyValue.value);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    0
  • 1.0.3
    0

Package Sidebar

Install

npm i nativescript-lazy

Weekly Downloads

0

Version

1.0.4

License

MIT

Last publish

Collaborators

  • mkloubert