wip: setup context + emit

This commit is contained in:
Evan You
2019-06-19 16:43:34 +08:00
parent 08806073a1
commit 5228f0343b
5 changed files with 121 additions and 78 deletions

View File

@@ -30,3 +30,16 @@ export const hyphenate = (str: string): string => {
export const capitalize = (str: string): string => {
return str.charAt(0).toUpperCase() + str.slice(1)
}
export function invokeHandlers(
handlers: Function | Function[],
args: any[] = EMPTY_ARR
) {
if (isArray(handlers)) {
for (let i = 0; i < handlers.length; i++) {
handlers[i].apply(null, args)
}
} else {
handlers.apply(null, args)
}
}