@spine/bootstrap

0.2.3 • Public • Published

Spine Bootstrap

This module will make sure your entire project is pluggable.

This is an additional dependency for Spine Hook

Usage

Create your hook

# myPlugin.ts
import {
  bootstrapHook,
  initHook,
  deathHook,
} from '@spine/bootstrap';

bootstrapHook.addAction('your-plugin', () => {
  /* This is an opportunite to bind or unbind any plugin */
  console.log('bootstrap');
});

initHook.addAction('your-plugin', async () => {
  /* Initialize something  */
  console.log('executed after bootstrap hook');
});

deathHook.addAction('your-plugin', async () => {
  /* It will execute when window unloads or process is killed */
  console.log('destroy');
});

Bootstrap your project

# index.ts
import { bootstrap } from '@spine/bootstrap/server';

// load your plugins
import './myPlugin';

bootstrap()
  .catch(error => console.log(error.stack || error.message));

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @spine/bootstrap

    Weekly Downloads

    6

    Version

    0.2.3

    License

    MIT

    Unpacked Size

    19 kB

    Total Files

    23

    Last publish

    Collaborators

    • ezsper