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:
parent
8318915d74
commit
a5d43e6925
6
dist/dde-with-observables.js
vendored
6
dist/dde-with-observables.js
vendored
File diff suppressed because one or more lines are too long
2
dist/dde.js
vendored
2
dist/dde.js
vendored
File diff suppressed because one or more lines are too long
6
dist/esm-with-observables.js
vendored
6
dist/esm-with-observables.js
vendored
File diff suppressed because one or more lines are too long
2
dist/esm.js
vendored
2
dist/esm.js
vendored
File diff suppressed because one or more lines are too long
@ -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))
|
||||
);
|
||||
});
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user