1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-24 01:29:36 +01:00

🐛 queueMicrotask 💄 is_readonly

This commit is contained in:
Jan Andrle 2024-02-03 09:06:04 +01:00
parent 8318915d74
commit a5d43e6925
Signed by: jaandrle
GPG Key ID: B3A25AED155AFFAB
7 changed files with 15 additions and 14 deletions

File diff suppressed because one or more lines are too long

2
dist/dde.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/esm.js vendored

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@ export function lifecycleToEvents(class_declaration){
});
wrapMethod(class_declaration.prototype, "disconnectedCallback", function(target, thisArg, detail){
target.apply(thisArg, detail);
(queueMicrotask || setTimeout)(
(globalThis.queueMicrotask || setTimeout)(
()=> !thisArg.isConnected && thisArg.dispatchEvent(new Event(evd))
);
});

View File

@ -123,7 +123,7 @@ function connectionsChangesObserverConstructor(){
const ls= store.get(element);
if(!ls.length_d) continue;
(queueMicrotask || setTimeout)(dispatchRemove(element));
(globalThis.queueMicrotask || setTimeout)(dispatchRemove(element));
out= true;
}
return out;

View File

@ -1,4 +1,4 @@
export const mark= Symbol.for("observable");
export const mark= "__dde_observable";
export function isObservable(candidate){
try{ return Reflect.has(candidate, mark); }
@ -194,7 +194,7 @@ function create(is_readonly, value, actions){
const varO= is_readonly
? ()=> read(varO)
: (...value)=> value.length ? write(varO, ...value) : read(varO);
return toObservable(varO, value, actions);
return toObservable(varO, value, actions, is_readonly);
}
const protoSigal= Object.assign(Object.create(null), {
stopPropagation(){
@ -209,7 +209,7 @@ class ObservableDefined extends Error{
this.stack= rest.find(l=> !l.includes(curr_file));
}
}
function toObservable(o, value, actions){
function toObservable(o, value, actions, readonly= false){
const onclear= [];
if(typeOf(actions)!=="[object Object]")
actions= {};
@ -223,7 +223,8 @@ function toObservable(o, value, actions){
value: {
value, actions, onclear, host,
listeners: new Set(),
defined: new ObservableDefined()
defined: (new ObservableDefined()).stack,
readonly
},
enumerable: false,
writable: false,