Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface EventEmitter<T extends Function> {
- on: T;
- }
- type MouseType = 'mousedown' | 'mouseup';
- type TouchType = 'touchstart' | 'touchend';
- type MouseOn = (m: MouseType, e: (e: MouseEvent) => void) => void;
- type TouchOn = (m: TouchType, e: (e: TouchEvent) => void) => void;
- let noop: any = () => { };
- class AABB implements EventEmitter<MouseOn&TouchOn> {
- on: MouseOn & TouchOn = noop;
- }
- let aabb = new AABB();
- aabb.on('mousedown', (param: MouseEvent) => {
- })
- aabb.on('touchstart', (param: TouchEvent) => {
- })
- aabb.on('mousedown', (param: TouchEvent) => {
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement