Skip to content

easylogic/magica

Repository files navigation

magica

magica is an utility to use magic method.

Install

npm install @easylogic/magica

How to use in es6

import {SUBSCRIBE, CLICK} from '@easylogic/magica'

View examples

npm run dev 

Base Sample

magica(CLICK('document button') + PREVENT , (e: any) => {
    emit('test', e);
})

magica(MOUSEOVER('document button') + PREVENT , (e: any) => {
    console.log('mouseover prevented', e.$dt);
})

magica(SUBSCRIBE('test'), (e) => {
    console.log('subscribe', e);
})

magica(BIND('button'), () => {
    return {
        style: {
            background: 'red',
            color: 'white'
        }
    }
})

magica(LOAD('button') + DOMDIFF, ($el) => {
    return `<div>${JSON.stringify($el.css('background-color'))}</div>`
})

emit('test');

local build

npm run build

LICENSE: MIT

About

magic method utility library

Resources

License

Stars

Watchers

Forks

Packages

No packages published