chore: fix tests
This commit is contained in:
parent
8d4abc3814
commit
11ed210391
@ -10,9 +10,7 @@ interface Invoker extends EventListener {
|
|||||||
attached: number
|
attached: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventValue = (Function | Function[]) & {
|
type EventValue = Function | Function[]
|
||||||
invoker?: Invoker | null
|
|
||||||
}
|
|
||||||
|
|
||||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||||
let _getNow: () => number = Date.now
|
let _getNow: () => number = Date.now
|
||||||
@ -70,11 +68,11 @@ export function patchEvent(
|
|||||||
const existingInvoker = invokers[rawName]
|
const existingInvoker = invokers[rawName]
|
||||||
if (nextValue && existingInvoker) {
|
if (nextValue && existingInvoker) {
|
||||||
// patch
|
// patch
|
||||||
;(prevValue as EventValue).invoker = null
|
|
||||||
existingInvoker.value = nextValue
|
existingInvoker.value = nextValue
|
||||||
} else {
|
} else {
|
||||||
const [name, options] = parseName(rawName)
|
const [name, options] = parseName(rawName)
|
||||||
if (nextValue) {
|
if (nextValue) {
|
||||||
|
// add
|
||||||
const invoker = (invokers[rawName] = createInvoker(nextValue, instance))
|
const invoker = (invokers[rawName] = createInvoker(nextValue, instance))
|
||||||
addEventListener(el, name, invoker, options)
|
addEventListener(el, name, invoker, options)
|
||||||
} else if (existingInvoker) {
|
} else if (existingInvoker) {
|
||||||
|
Loading…
Reference in New Issue
Block a user