Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// add isUnbinding flag
this.$state |= State.isUnbinding;
const sourceExpression = this.sourceExpression;
if (hasUnbind(sourceExpression)) {
sourceExpression.unbind(flags, this.$scope, this);
}
this.$scope = null;
this.handler.dispose();
this.handler = null;
// remove isBound and isUnbinding flags
this.$state &= ~(State.isBound | State.isUnbinding);
if (Tracer.enabled) { Tracer.leave(); }
}
public $unbind(flags: LifecycleFlags): void {
if (Tracer.enabled) { Tracer.enter('Call', '$unbind', slice.call(arguments)); }
if (!(this.$state & State.isBound)) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
// add isUnbinding flag
this.$state |= State.isUnbinding;
if (hasUnbind(this.sourceExpression)) {
this.sourceExpression.unbind(flags, this.$scope!, this);
}
this.$scope = void 0;
this.targetObserver.setValue(null, flags);
// remove isBound and isUnbinding flags
this.$state &= ~(State.isBound | State.isUnbinding);
if (Tracer.enabled) { Tracer.leave(); }
}
public $unbind(flags: LifecycleFlags): void {
if (Tracer.enabled) { Tracer.enter('Ref', '$unbind', slice.call(arguments)); }
if (!(this.$state & State.isBound)) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
// add isUnbinding flag
this.$state |= State.isUnbinding;
if (this.sourceExpression.evaluate(flags, this.$scope!, this.locator) === this.target) {
this.sourceExpression.assign!(flags, this.$scope!, this.locator, null);
}
const sourceExpression = this.sourceExpression;
if (hasUnbind(sourceExpression)) {
sourceExpression.unbind(flags, this.$scope!, this);
}
this.$scope = void 0;
export function $bindView(this: Required, flags: LifecycleFlags, scope: IScope): void {
if (Tracer.enabled) { Tracer.enter('IView', '$bind', slice.call(arguments)); }
flags |= LifecycleFlags.fromBind;
if (this.$state & State.isBound) {
if (this.$scope === scope) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
this.$unbind(flags);
}
// add isBinding flag
this.$state |= State.isBinding;
(this as Writable).$scope = scope;
let binding = this.$bindingHead;
while (binding != null) {
binding.$bind(flags, scope);
binding = binding.$nextBinding!;
}
this.bindChildNodes(node);
// the parentManifest will receive either the direct child nodes, or the template controllers / replace-parts
// wrapping them
this.bindAttributes(node, parentManifest);
if (manifestRoot != null && manifestRoot.isContainerless) {
node.parentNode.replaceChild(manifestRoot.marker, node);
}
else if (this.manifest.isTarget) {
node.classList.add('au');
}
// restore the stored manifests so the attributes are processed on the correct lavel
this.parentManifestRoot = parentManifestRootSave;
this.manifestRoot = manifestRootSave;
this.manifest = manifestSave;
if (Tracer.enabled) {
Tracer.leave();
}
}
bindLetElement(parentManifest, node) {
public enqueueConnect(requestor: IConnectableBinding): void {
if (Tracer.enabled) { Tracer.enter('Lifecycle', 'enqueueConnect', slice.call(arguments)); }
// enqueue connect and patch calls in separate lists so that they can be invoked
// independently from eachother
// TODO: see if we can eliminate/optimize some of this, because this is a relatively hot path
// (first get all the necessary integration tests working, then look for optimizations)
// build a standard singly linked list for connect callbacks
if (requestor.$nextConnect === null) {
requestor.$nextConnect = marker;
this.connectTail.$nextConnect = requestor;
this.connectTail = requestor;
++this.connectCount;
}
if (Tracer.enabled) { Tracer.leave(); }
}
flags |= LifecycleFlags.fromUnbind;
if (hooks & Hooks.hasUnbound) {
lifecycle.enqueueUnbound(this);
}
if (hooks & Hooks.hasUnbinding) {
this.unbinding(flags);
}
// remove isBound and isUnbinding flags
this.$state &= ~(State.isBound | State.isUnbinding);
lifecycle.endUnbind(flags);
}
if (Tracer.enabled) { Tracer.leave(); }
}
public beginUnbind(): void {
if (Tracer.enabled) { Tracer.enter('Lifecycle', 'beginUnbind', slice.call(arguments)); }
// open up / expand an unbind batch; the very first caller will close it again with endUnbind
++this.unbindDepth;
if (Tracer.enabled) { Tracer.leave(); }
}
public getValue(): unknown {
if (Tracer.enabled) { Tracer.enter('GetterObserver', 'getValue', slice.call(arguments)); }
if (this.subscriberCount === 0 || this.isCollecting) {
// tslint:disable-next-line: no-non-null-assertion // Non-null is implied because descriptors without getters won't end up here
this.currentValue = Reflect.apply(this.descriptor.get!, this.proxy, PLATFORM.emptyArray);
} else {
// tslint:disable-next-line: no-non-null-assertion // Non-null is implied because descriptors without getters won't end up here
this.currentValue = Reflect.apply(this.descriptor.get!, this.obj, PLATFORM.emptyArray);
}
if (Tracer.enabled) { Tracer.leave(); }
return this.currentValue;
}
type: TargetedInstructionType.setProperty,
to,
value
});
} else {
childInstructions.push(new SetAttributeInstruction(value, to));
}
}
});
}
if (children) {
addChildren(dom, element, children, allInstructions, dependencies);
}
if (Tracer.enabled) { Tracer.leave(); }
return new RenderPlan(dom, element, allInstructions, dependencies);
}