Use `registerEvents` to register multiple global events
This commit is contained in:
parent
707cba8ede
commit
367fe0e7a6
|
@ -1,11 +1,13 @@
|
||||||
import { on } from 'retrospring/utilities/on';
|
import registerEvents from 'retrospring/utilities/registerEvents';
|
||||||
import { createListHandler, createListInputHandler } from './create';
|
import { createListHandler, createListInputHandler } from './create';
|
||||||
import { destroyListHandler } from './destroy';
|
import { destroyListHandler } from './destroy';
|
||||||
import { listMembershipHandler } from './membership';
|
import { listMembershipHandler } from './membership';
|
||||||
|
|
||||||
export default (): void => {
|
export default (): void => {
|
||||||
on('click', 'input[type=checkbox][name=gm-list-check]', listMembershipHandler);
|
registerEvents([
|
||||||
on('click', 'button#create-list', createListHandler);
|
{ type: 'click', target: 'input[type=checkbox][name=gm-list-check]', handler: listMembershipHandler, global: true },
|
||||||
on('click', 'a#delete-list', destroyListHandler);
|
{ type: 'click', target: 'button#create-list', handler: createListHandler, global: true },
|
||||||
on('keyup', 'input#new-list-name', createListInputHandler);
|
{ type: 'click', target: 'a#delete-list', handler: destroyListHandler, global: true },
|
||||||
|
{ type: 'click', target: 'input#new-list-name', handler: createListInputHandler, global: true },
|
||||||
|
]);
|
||||||
}
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
import { userActionHandler } from './action';
|
import { userActionHandler } from './action';
|
||||||
import { userReportHandler } from './report';
|
import { userReportHandler } from './report';
|
||||||
import { on } from 'utilities/on';
|
import registerEvents from 'retrospring/utilities/registerEvents';
|
||||||
|
|
||||||
export default (): void => {
|
export default (): void => {
|
||||||
on('click', 'button[name=user-action]', userActionHandler);
|
registerEvents([
|
||||||
on('click', 'a[data-action=report-user]', userReportHandler);
|
{ type: 'click', target: 'button[name=user-action]', handler: userActionHandler, global: true },
|
||||||
|
{ type: 'click', target: 'a[data-action=report-user]', handler: userReportHandler, global: true }
|
||||||
|
]);
|
||||||
}
|
}
|
Loading…
Reference in New Issue