Last active
April 16, 2021 03:27
-
-
Save giangm9/760ef1201fb3fae61366f1d0a2b04b13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export declare type EventCallback<T> = (arg: T) => any; | |
export declare type Event<T = any> = EventCallback<T>[]; | |
export function emit<T>(e: Event<T>, data: T) { | |
e.forEach(callback => callback(data)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment