Skip to content

Installation

To install, simply type the command

sh
npm install act-master

If you use Vue, the Vue plugin is included in the package and available as a subpath export.

sh
npm install act-master

Now you need to initialize the library.

You can use two options, one is more suitable in your application prevails functional style, for example "Composition API" in Vue or functional components in React. If you use classes more often, like in Angular, you can use constructor initialization.

ts
import { act, ActMasterOptions } from 'act-master';
import { actions } from '@/act/generated/actions';

const options: ActMasterOptions = {
  actions,
};

act.init(options);
ts
import { ActMaster, ActMasterOptions } from 'act-master';
import { actions } from '../act/actions';

const options: ActMasterOptions = {
  actions,
};

const $act = new ActMaster(options);
ts
import { createApp } from 'vue';

import { act, ActMasterOptions } from 'act-master';
import { actions } from '../act/actions';

const options: ActMasterOptions = {
  actions,
};

act.init(options);

createApp(App).mount('#app');
ts
import Vue from 'vue';
import App from './App.vue';

import { VueActMaster, ActMasterOptions } from 'act-master/vue';
import { actions } from '../act/actions';

const options: ActMasterOptions = {
  actions,
};

Vue.use(VueActMaster, options);

new Vue({
  render: h => h(App),
}).$mount('#app');

ActMasterOptions

Description of configure parameters

PropertyDefaultDescription
actions?: ActMasterAction[];[]An array of action items
errorHandlerEventName?: ActEventName;undefinedAction call on error (can be used in actions too)
di?: DIMap;{}DI entities
autoUnsubscribeCallbackundefinedMethod for calling auto unsubscribe

Now all that's left to do is: