0.0.3: Exotic Type Gymnastics #3
|
@ -155,7 +155,7 @@ export default (options: ComponentOptions) => {
|
||||||
this._extractStatePathsFromExpression.bind(this),
|
this._extractStatePathsFromExpression.bind(this),
|
||||||
states: this._states,
|
states: this._states,
|
||||||
triggerFunc: this.triggerFunc.bind(this),
|
triggerFunc: this.triggerFunc.bind(this),
|
||||||
setupArrowFunctionHandler: utils.setupArrowFunctionHandler.bind(this),
|
// setupArrowFunctionHandler: utils.setupArrowFunctionHandler.bind(this),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import parseTemplate from './parseTemplate'
|
import parseTemplate from './parseTemplate'
|
||||||
import processTemplateMacros from './processTemplateMarco'
|
import processTemplateMacros from './processTemplateMarcos'
|
||||||
import setupArrowFunctionHandler from './setupArrowFunctionHandler'
|
import setupArrowFunctionHandler from './setupArrowFunctionHandler'
|
||||||
import triggerDomUpdates from './triggerDomUpdates'
|
import triggerDomUpdates from './triggerDomUpdates'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import setupArrowFunctionHandler from './setupArrowFunctionHandler'
|
||||||
|
|
||||||
export default function processTemplateMacros(
|
export default function processTemplateMacros(
|
||||||
element: Element,
|
element: Element,
|
||||||
context: CustomElement,
|
context: CustomElement,
|
||||||
|
@ -9,24 +11,6 @@ export default function processTemplateMacros(
|
||||||
expr: string,
|
expr: string,
|
||||||
attrValue: string,
|
attrValue: string,
|
||||||
) => void
|
) => void
|
||||||
setupArrowFunctionHandler: (
|
|
||||||
element: Element,
|
|
||||||
eventName: string,
|
|
||||||
handlerValue: string,
|
|
||||||
ops: {
|
|
||||||
createHandlerContext: (
|
|
||||||
event: Event,
|
|
||||||
element: Element,
|
|
||||||
) => {
|
|
||||||
states: Record<string, unknown>
|
|
||||||
stateToElementsMap: Record<string, Set<HTMLElement>>
|
|
||||||
statesListeners: Record<string, (value: unknown) => void>
|
|
||||||
setState: (keyPath: string, value: unknown) => void
|
|
||||||
getState: (keyPath: string) => unknown
|
|
||||||
triggerFunc: (eventName: string, ...args: unknown[]) => void
|
|
||||||
}
|
|
||||||
},
|
|
||||||
) => void
|
|
||||||
setupFunctionCallHandler: (
|
setupFunctionCallHandler: (
|
||||||
element: Element,
|
element: Element,
|
||||||
eventName: string,
|
eventName: string,
|
||||||
|
@ -162,7 +146,7 @@ export default function processTemplateMacros(
|
||||||
// Handle different types of event handlers
|
// Handle different types of event handlers
|
||||||
if (handlerValue.includes('=>')) {
|
if (handlerValue.includes('=>')) {
|
||||||
// Handle arrow function: @click="e => setState('count', count + 1)"
|
// Handle arrow function: @click="e => setState('count', count + 1)"
|
||||||
options.setupArrowFunctionHandler(
|
setupArrowFunctionHandler(
|
||||||
currentElementNode,
|
currentElementNode,
|
||||||
eventName,
|
eventName,
|
||||||
handlerValue,
|
handlerValue,
|
Loading…
Reference in New Issue
Block a user