@easylogic/magica
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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

Package Sidebar

Install

npm i @easylogic/magica

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

156 kB

Total Files

32

Last publish

Collaborators

  • easylogic