When your manifest is ready it has to be registered. It's up to you to decide how you want to handle concurrency, manage your asset and delay the execution. The function is expected to return nothing (void) and can do almost anything. It gets the captured event as an argument. The effect function is the effect itself, where it's logic is hidden. However, sometimes it cannot be done as for example effect that relies on cursor position can work only with mouse events. Effects should be agnostic to the event which invokes them. Each effect is described by MlgEffectManifest which contains all important information about the effect. The same rule applies to downloading from npm as mlg has to be imported before any effects. New effects can be added dynamically during MLG's lifetime.ĭownload it from NPM npm i -save mlg-basic-effects There is no requirement on adding the tag before tag with Mlg.init. When adding MLG Effect Pack using tag, it has to be added after the tag that adds MLG itself. Currently there is only one effect pack MLG Basic Effects which is under construction. In order to play effects an effect pack has to be added. General binding pattern is effect-name : event-name | biding-object where binding-object may be defined as map of event-name : DOMSelector Getting MLG Effect Packīy default MLG knows no effects. or if submit event occurs on any elementĬlick: ', *', Air Horn effect will me payed only if change occurs on input of type password Wow effect will be played anytime a keydown or keyup occurs anywhere Hit Marker effect will be played anytime a click event occurs anywhere Currently MLG captures events solely on body element The main task of MlgConfig is to bind effects to certain events and elements. MLG experience has to be configured via MlgConfig. MLG is automatically added to the global scope and can be accessed as Mlg. Each experience is unique as it is tailor in accordance to users' actions. React to DOM events and play various MLG effects. Bring genuine MLG experience to live websites.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |