[IMP] component: add support for callable expression in event handler

This commit is contained in:
Sébastien Theys
2021-07-01 11:12:21 +02:00
committed by Géry Debongnie
parent 3e0e8475a6
commit 7ebe0da962
4 changed files with 28 additions and 9 deletions
+1
View File
@@ -75,6 +75,7 @@ export function makeHandlerCode(
// we need to capture every variable in it
putInCache = false;
code = ctx.captureExpression(value);
code = `const res = (() => { return ${code} })(); if (typeof res === 'function') { res(e) }`;
}
const modCode = mods.map((mod) => modcodes[mod]).join("");
let handler = `function (e) {if (context.__owl__.status === ${STATUS.DESTROYED}){return}${modCode}${code}}`;