refactor: core.starting

This commit is contained in:
cha0s 2024-01-28 11:55:08 -06:00
parent 242c4ead9d
commit 0564ae5a52
5 changed files with 3 additions and 4 deletions

View File

@ -76,7 +76,7 @@ export const hooks = {
}, },
/** /**
* Invoked when the application is starting. Use for order-independent initialization tasks. * Invoked when the application is starting. Use for startup tasks.
*/ */
'@flecks/core.starting': () => { '@flecks/core.starting': () => {
console.log('starting!'); console.log('starting!');

View File

@ -369,6 +369,7 @@ exports.Flecks = class Flecks {
const Flecks = compose(...mixinDescription.map(([, mixin]) => mixin))(this); const Flecks = compose(...mixinDescription.map(([, mixin]) => mixin))(this);
const instance = new Flecks(runtime); const instance = new Flecks(runtime);
await instance.gatherHooks(); await instance.gatherHooks();
await instance.invokeSequentialAsync('@flecks/core.starting');
return instance; return instance;
} }

View File

@ -23,7 +23,7 @@
"runtime.js" "runtime.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.1.0" "@flecks/core": "^3.1.3"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.1.3", "@flecks/build": "^3.1.3",

View File

@ -23,7 +23,6 @@ const {version} = require('../package.json');
debug('starting server...'); debug('starting server...');
try { try {
global.flecks = await Flecks.from({...runtime, flecks: await loadFlecks()}); global.flecks = await Flecks.from({...runtime, flecks: await loadFlecks()});
await Promise.all(global.flecks.invokeFlat('@flecks/core.starting'));
await global.flecks.invokeSequentialAsync('@flecks/server.up'); await global.flecks.invokeSequentialAsync('@flecks/server.up');
debug('up!'); debug('up!');
} }

View File

@ -56,7 +56,6 @@ const {version} = require('@flecks/web/package.json');
try { try {
const flecks = await Flecks.from(runtime); const flecks = await Flecks.from(runtime);
window.flecks = flecks; window.flecks = flecks;
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
await flecks.invokeSequentialAsync('@flecks/web/client.up'); await flecks.invokeSequentialAsync('@flecks/web/client.up');
const appMountContainerId = `#${config['@flecks/web'].appMountId}-container`; const appMountContainerId = `#${config['@flecks/web'].appMountId}-container`;
window.document.querySelector(appMountContainerId).style.display = 'block'; window.document.querySelector(appMountContainerId).style.display = 'block';