Skip to content

Commit

Permalink
add 'allow-globals' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Oct 7, 2024
1 parent 637e736 commit 1414ed6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions datex-bindings/dom-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ export class DOMUtils {
{element},
// init (called once)
({element}) => {
use (this, logger, val, rootPath, isolatedScope)
use("allow-globals", this, logger, val, rootPath, isolatedScope)
const handler = isolatedScope(v => {
use (this, logger, rootPath, element)
use("allow-globals", this, logger, rootPath, element)
const deref = element.deref();
if (!deref) {
logger.warn("Undetected garbage collection (uix-w0001)");
Expand Down Expand Up @@ -472,10 +472,10 @@ export class DOMUtils {

weakAction({element},
({element}) => {
use (this, attr, rootPath, logger, val, isolatedScope);
use("allow-globals", this, attr, rootPath, logger, val, isolatedScope);

const handler = isolatedScope((v:any,...args) => {
use (this, logger, rootPath, element, attr);
use("allow-globals", this, logger, rootPath, element, attr);
const deref = element.deref();
if (!deref) {
logger.warn("Undetected garbage collection (uix-w0001)");
Expand Down Expand Up @@ -583,9 +583,9 @@ export class DOMUtils {

weakAction({element},
({element}) => {
use (theVal, logger, Datex, isolatedScope);
use("allow-globals", theVal, logger, Datex, isolatedScope);
const handler = isolatedScope((val:any) => {
use (logger, element);
use("allow-globals", logger, element);
const deref = element.deref();
if (!deref) {
logger.warn("Undetected garbage collection (uix-w0001)");
Expand All @@ -597,7 +597,7 @@ export class DOMUtils {
Datex.ReactiveValue.observeAndInit(theVal, handler);
return handler;
},
(handler) => use(Datex, theVal) && Datex.ReactiveValue.unobserve(theVal, handler)
(handler) => use("allow-globals", Datex, theVal) && Datex.ReactiveValue.unobserve(theVal, handler)
);

}
Expand Down Expand Up @@ -995,13 +995,13 @@ export class DOMUtils {

weakAction({node, ref},
({node, ref}) => {
use (logger, Datex, isolatedScope);
use("allow-globals", logger, Datex, isolatedScope);

let prevNode:{node?:WeakRef<Node>} = {node};

// TODO: dont reference 'ref' in handler, use args from handler
const handler = isolatedScope((...args:any[]) => {
use (logger, ref, prevNode);
use("allow-globals", logger, ref, prevNode);

let prevNodeDeref = prevNode.node?.deref()!;

Expand Down Expand Up @@ -1039,7 +1039,7 @@ export class DOMUtils {
return handler;
},
(handler, _, deps) => {
use(Datex);
use("allow-globals", Datex);
Datex.ReactiveValue.unobserve(deps.ref, handler)
},
{ref}
Expand Down

0 comments on commit 1414ed6

Please sign in to comment.