magica is an utility to use magic method.
npm install @easylogic/magica
import {SUBSCRIBE, CLICK} from '@easylogic/magica'
npm run dev
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');
npm run build