Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
4e8dd83839 | |||
7ab1a4eec7 | |||
3098fbec89 | |||
1caa8a7c31 | |||
c689a3c349 | |||
a8a0778708 | |||
82ebb181a0 |
42
README.md
42
README.md
@ -2,14 +2,15 @@
|
|||||||
simplifies lazy loading with TypeScript
|
simplifies lazy loading with TypeScript
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty
|
||||||
[](https://www.npmjs.com/package/smartsystem)
|
[](https://www.npmjs.com/package/smartsystem)
|
||||||
[](https://gitlab.com/pushrocks/smartsystem)
|
[](https://GitLab.com/pushrocks/smartsystem)
|
||||||
[](https://github.com/pushrocks/smartsystem)
|
[](https://github.com/pushrocks/smartsystem)
|
||||||
[](https://pushrocks.gitlab.io/smartsystem/)
|
[](https://pushrocks.gitlab.io/smartsystem/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/pushrocks/smartsystem/commits/master)
|
[](https://GitLab.com/pushrocks/smartsystem/commits/master)
|
||||||
[](https://gitlab.com/pushrocks/smartsystem/commits/master)
|
[](https://GitLab.com/pushrocks/smartsystem/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/smartsystem)
|
||||||
[](https://david-dm.org/pushrocks/smartsystem)
|
[](https://david-dm.org/pushrocks/smartsystem)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartsystem/master/dependencies/npm)
|
[](https://www.bithound.io/github/pushrocks/smartsystem/master/dependencies/npm)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartsystem)
|
[](https://www.bithound.io/github/pushrocks/smartsystem)
|
||||||
@ -22,27 +23,42 @@ We recommend the use of TypeScript for best Intellisense
|
|||||||
|
|
||||||
smartsystem supports both npm and SystemJs as module loader.
|
smartsystem supports both npm and SystemJs as module loader.
|
||||||
|
|
||||||
```typescript
|
```javascript
|
||||||
import { LazyModule } from 'smartsystem'
|
import { LazyModule } from 'smartsystem'
|
||||||
|
|
||||||
import * as _myPlugin from 'myPlugin' // plugin does not get loaded here at runtime
|
// plugin does not get loaded here at runtime
|
||||||
let myPluginLazy = new LazyModule<typeof _myPlugin>('myPlugin')
|
import * as _myPlugin from 'myPlugin'
|
||||||
myPluginLazy.setLoader('npm') // sets the loader, defaults to npm anyway
|
|
||||||
|
|
||||||
|
// define the lazy module
|
||||||
|
let myLazyModule = new LazyModule<typeof _myPlugin>('myPlugin', __dirname)
|
||||||
|
|
||||||
|
// set the loader, defaults to npm anyway, can be systemjs alternatively
|
||||||
|
myLazyModule.setLoader('npm')
|
||||||
|
|
||||||
|
// another plugin
|
||||||
import * as _anotherPlugin from 'anotherPlugin' // plugin does not get loaded here at runtime
|
import * as _anotherPlugin from 'anotherPlugin' // plugin does not get loaded here at runtime
|
||||||
let anotherPluginLazy = new LazyModule<typeof _anotherPlugin>('anotherPlugin')
|
|
||||||
|
// define lazy module
|
||||||
|
let anotherLazyModule = new LazyModule<typeof _anotherPlugin>('anotherPlugin', __dirname)
|
||||||
anotherPluginLazy.setLoader('systemjs') // sets the loader to systemjs
|
anotherPluginLazy.setLoader('systemjs') // sets the loader to systemjs
|
||||||
|
|
||||||
myPluginLazy.whenLoaded.then(myPlugin => {
|
myLazyModule.whenLoaded.then(myPlugin => {
|
||||||
/* do something with myPlugin.
|
/* do something with myPlugin.
|
||||||
myPlugin receives the typings flow from LazyModule class
|
myPlugin receives the typings flow from LazyModule class
|
||||||
This does NOT load the module during runtime
|
This does NOT load the module during runtime
|
||||||
The promise whenLoaded will be resolved whenever load() is called for the first time */
|
The promise whenLoaded will be resolved whenever load() is called for the first time */
|
||||||
})
|
})
|
||||||
|
|
||||||
myPluginLazy.load().then(myPlugin => {
|
myLazyModule.load().then(myPlugin => {
|
||||||
/* do something with myPlugin.
|
/* do something with myPlugin.
|
||||||
myPlugin receives the typings flow from LazyModule class
|
myPlugin receives the typings flow from LazyModule class
|
||||||
This DOES LOAD the module */
|
This DOES LOAD the module */
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
||||||
|
7
npmextra.json
Normal file
7
npmextra.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"npmci": {
|
||||||
|
"globalNpmTools": [
|
||||||
|
"npmts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smartsystem",
|
"name": "smartsystem",
|
||||||
"version": "1.0.10",
|
"version": "1.0.13",
|
||||||
"description": "simplifies lazy loading with TypeScript",
|
"description": "simplifies lazy loading with TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
Reference in New Issue
Block a user