A TypeScript library for interacting with the system it's running on, including environment, network, and hardware information.
Go to file
2016-10-06 19:28:00 +02:00
ts initial 2016-10-06 19:28:00 +02:00
.gitlab-ci.yml initial 2016-10-06 19:28:00 +02:00
package.json initial 2016-10-06 19:28:00 +02:00
README.md initial 2016-10-06 19:28:00 +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, loadNow } from 'smartsystem'

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

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

myPluginPromised.then(myPlugin => { /* do something with myPlugin */ })
myPlugin.also(anotherPluginPromised).then((m,a) => {}) // also takes multiple other plugins

loadNow.only('myPlugin') // loads myPlugin and resolved the lazy promise
loadNow.also('myPlugin') // loads myPlugin and any chained 'also' modules