A TypeScript library for interacting with the system it's running on, including environment, network, and hardware information.
Go to file
2016-10-12 14:07:57 +02:00
dist small fix 2016-10-12 14:07:54 +02:00
test first working version 2016-10-12 14:01:15 +02:00
ts small fix 2016-10-12 14:07:54 +02:00
.gitignore update 2016-10-06 23:00:29 +02:00
.gitlab-ci.yml initial 2016-10-06 19:28:00 +02:00
package.json 1.0.2 2016-10-12 14:07:57 +02:00
README.md first working version 2016-10-12 14:01:15 +02:00
tslint.json add basic module structure 2016-10-12 01:41:30 +02:00

smartsystem

simplifies lazy loading with TypeScript

Availabililty

npm git git docs

Status for master

build status coverage report Dependency Status bitHound Dependencies bitHound Code TypeScript node JavaScript Style Guide

Usage

We recommend the use of TypeScript for best Intellisense

import { LazyModule } from 'smartsystem'

import * as myPluginType from 'myPlugin' // plugin does not get loaded here at runtime
let myPluginLazy = new LazyModule<typeof myPlugin>('myPlugin')

import * as anotherPluginType from 'anotherPlugin' // plugin does not get loaded here at runtime
let anotherPluginPromised = LazyModule<typeof anotherPlugin>('anotherPlugin')

myPluginLazy.whenLoaded.then(myPlugin => {
    /* do something with myPlugin. 
       myPlugin receives the typings flow from LazyModule class
       This does NOT load the module during runtime
       The promise whenLoaded will be resolved whenever load() is called for the first time */
})

myPluginLazy.load().then(myPlugin => {
    /* do something with myPlugin. 
       myPlugin receives the typings flow from LazyModule class
       This DOES LOAD the module */
})