@domql/event
Advanced tools
Comparing version 2.5.187 to 2.5.190
@@ -20,1 +20,2 @@ "use strict"; | ||
__reExport(event_exports, require("./can.js"), module.exports); | ||
__reExport(event_exports, require("./animationFrame.js"), module.exports); |
@@ -21,3 +21,2 @@ "use strict"; | ||
__export(on_exports, { | ||
applyAnimationFrame: () => applyAnimationFrame, | ||
applyEvent: () => applyEvent, | ||
@@ -50,18 +49,9 @@ applyEventUpdate: () => applyEventUpdate, | ||
}; | ||
const triggerEventOnUpdate = (param, updatedObj, element, options) => { | ||
const triggerEventOnUpdate = async (param, updatedObj, element, options) => { | ||
const appliedFunction = getOnOrPropsEvent(param, element); | ||
if (appliedFunction) { | ||
const { state, context } = element; | ||
return applyEventUpdate(appliedFunction, updatedObj, element, state, context, options); | ||
return await applyEventUpdate(appliedFunction, updatedObj, element, state, context, options); | ||
} | ||
}; | ||
const applyAnimationFrame = (element, options) => { | ||
const { props, on, __ref: ref } = element; | ||
const { frameListeners } = ref.root.data; | ||
if (frameListeners && ((on == null ? void 0 : on.frame) || (props == null ? void 0 : props.onFrame))) { | ||
const { registerFrameListener } = element.context.utils; | ||
if (registerFrameListener) | ||
registerFrameListener(element); | ||
} | ||
}; | ||
const applyEventsOnNode = (element, options) => { | ||
@@ -74,5 +64,5 @@ const { node, on } = element; | ||
if ((0, import_utils.isFunction)(appliedFunction)) { | ||
node.addEventListener(param, (event) => { | ||
node.addEventListener(param, async (event) => { | ||
const { state, context } = element; | ||
appliedFunction.call(element, event, element, state, context, options); | ||
await appliedFunction.call(element, event, element, state, context, options); | ||
}); | ||
@@ -79,0 +69,0 @@ } |
export * from "./on.js"; | ||
export * from "./can.js"; | ||
export * from "./animationFrame.js"; |
@@ -21,18 +21,9 @@ import { isFunction } from "@domql/utils"; | ||
}; | ||
const triggerEventOnUpdate = (param, updatedObj, element, options) => { | ||
const triggerEventOnUpdate = async (param, updatedObj, element, options) => { | ||
const appliedFunction = getOnOrPropsEvent(param, element); | ||
if (appliedFunction) { | ||
const { state, context } = element; | ||
return applyEventUpdate(appliedFunction, updatedObj, element, state, context, options); | ||
return await applyEventUpdate(appliedFunction, updatedObj, element, state, context, options); | ||
} | ||
}; | ||
const applyAnimationFrame = (element, options) => { | ||
const { props, on, __ref: ref } = element; | ||
const { frameListeners } = ref.root.data; | ||
if (frameListeners && ((on == null ? void 0 : on.frame) || (props == null ? void 0 : props.onFrame))) { | ||
const { registerFrameListener } = element.context.utils; | ||
if (registerFrameListener) | ||
registerFrameListener(element); | ||
} | ||
}; | ||
const applyEventsOnNode = (element, options) => { | ||
@@ -45,5 +36,5 @@ const { node, on } = element; | ||
if (isFunction(appliedFunction)) { | ||
node.addEventListener(param, (event) => { | ||
node.addEventListener(param, async (event) => { | ||
const { state, context } = element; | ||
appliedFunction.call(element, event, element, state, context, options); | ||
await appliedFunction.call(element, event, element, state, context, options); | ||
}); | ||
@@ -54,3 +45,2 @@ } | ||
export { | ||
applyAnimationFrame, | ||
applyEvent, | ||
@@ -57,0 +47,0 @@ applyEventUpdate, |
@@ -5,1 +5,2 @@ 'use strict' | ||
export * from './can.js' | ||
export * from './animationFrame.js' |
17
on.js
@@ -27,19 +27,10 @@ 'use strict' | ||
export const triggerEventOnUpdate = (param, updatedObj, element, options) => { | ||
export const triggerEventOnUpdate = async (param, updatedObj, element, options) => { | ||
const appliedFunction = getOnOrPropsEvent(param, element) | ||
if (appliedFunction) { | ||
const { state, context } = element | ||
return applyEventUpdate(appliedFunction, updatedObj, element, state, context, options) | ||
return await applyEventUpdate(appliedFunction, updatedObj, element, state, context, options) | ||
} | ||
} | ||
export const applyAnimationFrame = (element, options) => { | ||
const { props, on, __ref: ref } = element | ||
const { frameListeners } = ref.root.data | ||
if (frameListeners && (on?.frame || props?.onFrame)) { | ||
const { registerFrameListener } = element.context.utils | ||
if (registerFrameListener) registerFrameListener(element) | ||
} | ||
} | ||
export const applyEventsOnNode = (element, options) => { | ||
@@ -68,5 +59,5 @@ const { node, on } = element | ||
if (isFunction(appliedFunction)) { | ||
node.addEventListener(param, event => { | ||
node.addEventListener(param, async event => { | ||
const { state, context } = element | ||
appliedFunction.call(element, event, element, state, context, options) | ||
await appliedFunction.call(element, event, element, state, context, options) | ||
}) | ||
@@ -73,0 +64,0 @@ } |
{ | ||
"name": "@domql/event", | ||
"version": "2.5.187", | ||
"version": "2.5.190", | ||
"license": "MIT", | ||
@@ -34,3 +34,3 @@ "type": "module", | ||
}, | ||
"gitHead": "c150bfbbdd51b19d25c93f10334d54175cea9d1d" | ||
"gitHead": "c4e06a81317c6d43c070d9ad93bbaeba24b3bb3b" | ||
} |
23336
21
581