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 { destroyListHandler } from './destroy';
|
||||
import { listMembershipHandler } from './membership';
|
||||
|
||||
export default (): void => {
|
||||
on('click', 'input[type=checkbox][name=gm-list-check]', listMembershipHandler);
|
||||
on('click', 'button#create-list', createListHandler);
|
||||
on('click', 'a#delete-list', destroyListHandler);
|
||||
on('keyup', 'input#new-list-name', createListInputHandler);
|
||||
registerEvents([
|
||||
{ type: 'click', target: 'input[type=checkbox][name=gm-list-check]', handler: listMembershipHandler, global: true },
|
||||
{ type: 'click', target: 'button#create-list', handler: createListHandler, global: true },
|
||||
{ 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 { userReportHandler } from './report';
|
||||
import { on } from 'utilities/on';
|
||||
import registerEvents from 'retrospring/utilities/registerEvents';
|
||||
|
||||
export default (): void => {
|
||||
on('click', 'button[name=user-action]', userActionHandler);
|
||||
on('click', 'a[data-action=report-user]', userReportHandler);
|
||||
registerEvents([
|
||||
{ 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