Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
flags |= LifecycleFlags.fromDetach;
const hooks = this.$hooks;
if (hooks & Hooks.hasDetaching) {
this.detaching(flags);
}
// remove isAttached and isDetaching flags
this.$state &= ~(State.isAttached | State.isDetaching);
if (hooks & Hooks.hasDetached) {
lifecycle.enqueueDetached(this);
}
lifecycle.endDetach(flags);
}
if (Tracer.enabled) { Tracer.leave(); }
}
function createGetterTraps(flags: LifecycleFlags, observerLocator: IObserverLocator, observer: GetterObserver): ProxyHandler {
if (Tracer.enabled) { Tracer.enter('computed', 'createGetterTraps', slice.call(arguments)); }
const traps = {
get: function(target: object, key: PropertyKey, receiver?: unknown): unknown {
if (Tracer.enabled) { Tracer.enter('computed', 'get', slice.call(arguments)); }
if (observer.doNotCollect(key)) {
if (Tracer.enabled) { Tracer.leave(); }
return Reflect.get(target, key, receiver);
}
// The length and iterator properties need to be invoked on the original object (for Map and Set
// at least) or they will throw.
switch (toStringTag.call(target)) {
case '[object Array]':
observer.addCollectionDep(observerLocator.getArrayObserver(flags, target as unknown[]));
if (key === 'length') {
if (Tracer.enabled) { Tracer.leave(); }
return Reflect.get(target, key, target);
export function disableTracing() {
Tracer.flushAll(null);
Object.assign(Tracer, RuntimeTracer);
Tracer.enabled = false;
}
export const SymbolTraceWriter = {
constructor(obj: Record, propertyKey: string) {
if (Tracer.enabled) { Tracer.enter('ArrayObserver.constructor', slice.call(arguments)); }
this.obj = obj;
this.propertyKey = propertyKey;
if (Tracer.enabled) { Tracer.leave(); }
}
this.currentValue = instance.$raw[propertyName];
this.callback = callbackName in instance.$raw
? instance[callbackName].bind(instance)
: noop;
} else {
this.obj = instance;
this.propertyKey = propertyName;
this.currentValue = instance[propertyName];
this.callback = callbackName in instance
? instance[callbackName].bind(instance)
: noop;
}
if (flags & LifecycleFlags.patchStrategy) {
this.getValue = this.getValueDirect;
}
if (Tracer.enabled) { Tracer.leave(); }
}
constructor(flags: LifecycleFlags, lifecycle: ILifecycle, array: IObservedArray) {
if (Tracer.enabled) { Tracer.enter('ArrayObserver.constructor', slice.call(arguments)); }
this.lifecycle = lifecycle;
array.$observer = this;
this.collection = array;
this.flags = flags & LifecycleFlags.persistentBindingFlags;
this.resetIndexMap();
if (Tracer.enabled) { Tracer.leave(); }
}
}
const result = this.render(flags, host, options.parts!, parentContext);
if (result && 'getElementTemplate' in result) {
const template = result.getElementTemplate(renderingEngine, Type, parentContext);
template.render(this, host, options.parts);
}
} else {
const template = renderingEngine.getElementTemplate(dom, description, parentContext, Type);
template.render(this, host, options.parts);
}
if (this.$hooks & Hooks.hasCreated) {
bindingContext.created(flags);
}
if (Profiler.enabled) { leave(); }
if (Tracer.enabled) { Tracer.leave(); }
}
constructor(flags: LifecycleFlags, lifecycle: ILifecycle, map: IObservedMap) {
if (Tracer.enabled) { Tracer.enter('MapObserver', 'constructor', slice.call(arguments)); }
if (!enableMapObservationCalled) {
enableMapObservationCalled = true;
enableMapObservation();
}
this.inBatch = false;
this.collection = map;
this.persistentFlags = flags & LifecycleFlags.persistentBindingFlags;
this.indexMap = createIndexMap(map.size);
this.lifecycle = lifecycle;
this.lengthObserver = (void 0)!;
map.$observer = this;
bind(node) {
if (Tracer.enabled) {
Tracer.enter('TemplateBinder', 'bind', slice.call(arguments));
}
if (Profiler.enabled) {
enter();
}
const surrogateSave = this.surrogate;
const parentManifestRootSave = this.parentManifestRoot;
const manifestRootSave = this.manifestRoot;
const manifestSave = this.manifest;
const manifest = this.surrogate = this.manifest = new PlainElementSymbol(node);
const attributes = node.attributes;
let i = 0;
while (i < attributes.length) {
const attr = attributes[i];
const attrSyntax = this.attrParser.parse(attr.name, attr.value);
if (invalidSurrogateAttribute[attrSyntax.target] === true) {
constructor(dirtyChecker: IDirtyChecker, obj: IObservable, propertyKey: string) {
if (Tracer.enabled) { Tracer.enter('DirtyCheckProperty', 'constructor', slice.call(arguments)); }
this.obj = obj;
this.propertyKey = propertyKey;
this.dirtyChecker = dirtyChecker;
if (Tracer.enabled) { Tracer.leave(); }
}