المُفَوّض or The MUFAwwad is the engine of this library. it handles creation of Mufa instances.
(Registry)
: The store
import {on, fire} from 'mufa';
// publish
setTimeout(() => {
fire('sendEmoji', '👏')
}, 1000) ;
// subscribe
on('sendEmoji', (emoji) => console.log(emoji));
Subscribe to event and save the callback to be running when the event is published (fired)
(String)
event name
(Function)
callback to be running when the event is published
(Boolean?
= false
)
it restricts subscriber's notification only for the 1ˢᵗ publish
Subscription
:
Subscription's info
Cancel the subscription which was done with "sub" or "one" or "once"
(Subscription)
One subscription for each argument
Array<Subscription>
:
arguments
Subscribe to event and save the callback to be running when the event is published (fired).
It is an alias of mufa.sub
Subscription
:
Subscription's info
Subscribe once to event and save the callback to be running when the event is published (fired)
It is almost an alias of mufa.sub.
Subscription
:
Subscription's info
Publish (fire) an event & notify event's subscribers immediatly.
It is an alias of mufa.pub
(String)
The event name
(any)
message(s) to be sent to subscribers
undefined
:
Cancel the subscription which was done with "sub" or "one" or "once" It is an alias of mufa.unsub.
(Subscription)
One subscription for each argument
Array<Subscription>
:
arguments
Type: Object