@fusion.io/core
Advanced tools
Comparing version 2.5.0-rc13 to 2.5.0-rc15
@@ -1,12 +0,48 @@ | ||
import { DependencyKey } from "@fusion.io/container"; | ||
/** | ||
* Plasma is just a simple service composer. | ||
* | ||
*/ | ||
declare type Plasma = { | ||
dependencies: DependencyKey[]; | ||
bootstrapper(...dependencies: any[]): void; | ||
/** | ||
* Composes the app | ||
* | ||
* @param app | ||
*/ | ||
compose(app: Tokamak): void; | ||
/** | ||
* Bootstrap the application after the service | ||
* has been composed | ||
* | ||
*/ | ||
boot?(): void; | ||
}; | ||
/** | ||
* An application core. | ||
* It is nothing special but a "place" | ||
* for the plasma working around. | ||
* | ||
*/ | ||
export default class Tokamak { | ||
/** | ||
* Supported plasma | ||
* | ||
*/ | ||
private plasmas; | ||
/** | ||
* | ||
* @param configuration | ||
*/ | ||
constructor(configuration: any); | ||
/** | ||
* Fuse this Tokamak with some plasma | ||
* | ||
* @param plasma | ||
*/ | ||
fuse(plasma: Plasma): this; | ||
start(): void; | ||
/** | ||
* Start this Tokamak | ||
* | ||
*/ | ||
start(): this; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const container_1 = require("@fusion.io/container"); | ||
/** | ||
* An application core. | ||
* It is nothing special but a "place" | ||
* for the plasma working around. | ||
* | ||
*/ | ||
class Tokamak { | ||
/** | ||
* | ||
* @param configuration | ||
*/ | ||
constructor(configuration) { | ||
/** | ||
* Supported plasma | ||
* | ||
*/ | ||
this.plasmas = []; | ||
container_1.container.value('config', configuration); | ||
} | ||
/** | ||
* Fuse this Tokamak with some plasma | ||
* | ||
* @param plasma | ||
*/ | ||
fuse(plasma) { | ||
this.plasmas.push(plasma); | ||
plasma.compose(this); | ||
return this; | ||
} | ||
/** | ||
* Start this Tokamak | ||
* | ||
*/ | ||
start() { | ||
this.plasmas.forEach(plasma => { | ||
const resolved = plasma.dependencies.map(dependency => container_1.container.make(dependency)); | ||
plasma.bootstrapper(...resolved); | ||
}); | ||
this.plasmas.forEach(plasma => plasma.boot && plasma.boot()); | ||
return this; | ||
} | ||
@@ -19,0 +41,0 @@ } |
{ | ||
"name": "@fusion.io/core", | ||
"version": "2.5.0-rc13", | ||
"version": "2.5.0-rc15", | ||
"description": "Fusion Core. Better App Bootstrap for better Geeks.", | ||
@@ -25,3 +25,3 @@ "publishConfig": { | ||
"scripts": { | ||
"tsc": "tsc", | ||
"tsc": "rm -rf lib && tsc", | ||
"build": "tsc && tsc -m es6 --outDir lib-esm", | ||
@@ -33,7 +33,7 @@ "test": "echo \"Error: run tests from root\" && exit 1" | ||
}, | ||
"gitHead": "4a4a9a1deb9b99d27149ac9210a0ad9f3de29c43", | ||
"gitHead": "3cb089344cf3dbaf0c6e4a9696bc613dd17b9d9b", | ||
"dependencies": { | ||
"@fusion.io/container": "^2.5.0-rc13", | ||
"@fusion.io/utils": "^2.5.0-rc13" | ||
"@fusion.io/container": "^2.5.0-rc15", | ||
"@fusion.io/utils": "^2.5.0-rc15" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
4219
107
8