How to use the @aurelia/runtime.hasUnbind function in @aurelia/runtime

To help you get started, we’ve selected a few @aurelia/runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / runtime-html / dist / index.es6.js View on Github external
$unbind(flags) {
        if (!(this.$state & 2 /* isBound */)) {
            return;
        }
        // add isUnbinding flag
        this.$state |= 64 /* 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 &= ~(2 /* isBound */ | 64 /* isUnbinding */);
    }
    observeProperty(flags, obj, propertyName) {
github aurelia / aurelia / packages / runtime-html / dist / esnext / binding / listener.js View on Github external
$unbind(flags) {
        if (!(this.$state & 4 /* isBound */)) {
            return;
        }
        // add isUnbinding flag
        this.$state |= 2 /* isUnbinding */;
        const sourceExpression = this.sourceExpression;
        if (hasUnbind(sourceExpression)) {
            sourceExpression.unbind(flags, this.$scope, this.interceptor);
        }
        this.$scope = null;
        this.handler.dispose();
        this.handler = null;
        // remove isBound and isUnbinding flags
        this.$state &= ~(4 /* isBound */ | 2 /* isUnbinding */);
    }
    observeProperty(flags, obj, propertyName) {
github aurelia / aurelia / packages / runtime-html / dist / esnext / binding / attribute.js View on Github external
$unbind(flags) {
        if (!(this.$state & 4 /* isBound */)) {
            return;
        }
        // add isUnbinding flag
        this.$state |= 2 /* isUnbinding */;
        // clear persistent flags
        this.persistentFlags = 0 /* none */;
        if (hasUnbind(this.sourceExpression)) {
            this.sourceExpression.unbind(flags, this.$scope, this.interceptor);
        }
        this.$scope = null;
        if (this.targetObserver.unbind) {
            this.targetObserver.unbind(flags);
        }
        if (this.targetObserver.unsubscribe) {
            this.targetObserver.unsubscribe(this.interceptor);
            this.targetObserver[this.id] &= ~32 /* updateSourceExpression */;
        }
        this.interceptor.unobserve(true);
        // remove isBound and isUnbinding flags
        this.$state &= ~(4 /* isBound */ | 2 /* isUnbinding */);
    }
    connect(flags) {
github aurelia / aurelia / packages / runtime-html / src / binding / attribute.ts View on Github external
public $unbind(flags: LifecycleFlags): void {
    if (!(this.$state & State.isBound)) {
      return;
    }
    // add isUnbinding flag
    this.$state |= State.isUnbinding;

    // clear persistent flags
    this.persistentFlags = LifecycleFlags.none;

    if (hasUnbind(this.sourceExpression)) {
      this.sourceExpression.unbind(flags, this.$scope, this);
    }
    this.$scope = null!;

    if ((this.targetObserver as IBindingTargetObserver).unbind) {
      (this.targetObserver as IBindingTargetObserver).unbind!(flags);
    }
    if ((this.targetObserver as IBindingTargetObserver).unsubscribe) {
      (this.targetObserver as IBindingTargetObserver).unsubscribe(this);
      (this.targetObserver as IBindingTargetObserver & { [key: string]: number })[this.id] &= ~LifecycleFlags.updateSourceExpression;
    }
    this.unobserve(true);

    // remove isBound and isUnbinding flags
    this.$state &= ~(State.isBound | State.isUnbinding);
  }
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
it('hasUnbind', function () {
    expect(hasUnbind(new AccessThis()                )).to.equal(false);
    expect(hasUnbind(new AccessScope('')             )).to.equal(false);
    expect(hasUnbind(new ArrayLiteral([])            )).to.equal(false);
    expect(hasUnbind(new ObjectLiteral([], [])       )).to.equal(false);
    expect(hasUnbind(new PrimitiveLiteral('')        )).to.equal(false);
    expect(hasUnbind(new Template([])                )).to.equal(false);
    expect(hasUnbind(new Unary('!', e)               )).to.equal(false);
    expect(hasUnbind(new CallScope('!', [])          )).to.equal(false);
    expect(hasUnbind(new CallMember(e, '', [])       )).to.equal(false);
    expect(hasUnbind(new CallFunction(e, [])         )).to.equal(false);
    expect(hasUnbind(new AccessMember(e, '')         )).to.equal(false);
    expect(hasUnbind(new AccessKeyed(e, e)           )).to.equal(false);
    expect(hasUnbind(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(hasUnbind(new Binary('+', e, e)           )).to.equal(false);
    expect(hasUnbind(new Conditional(e, e, e)        )).to.equal(false);
    expect(hasUnbind(new Assign(e, e)                )).to.equal(false);
    expect(hasUnbind(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(hasUnbind(new BindingBehavior(e, '', [])  )).to.equal(true);
    expect(hasUnbind(new HtmlLiteral([])             )).to.equal(false);
    expect(hasUnbind(new ArrayBindingPattern([])     )).to.equal(false);
    expect(hasUnbind(new ObjectBindingPattern([], []))).to.equal(false);
    expect(hasUnbind(new BindingIdentifier('')       )).to.equal(false);
    expect(hasUnbind(new ForOfStatement(e, e)        )).to.equal(true);
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
it('hasUnbind', function () {
    expect(hasUnbind(new AccessThis()                )).to.equal(false);
    expect(hasUnbind(new AccessScope('')             )).to.equal(false);
    expect(hasUnbind(new ArrayLiteral([])            )).to.equal(false);
    expect(hasUnbind(new ObjectLiteral([], [])       )).to.equal(false);
    expect(hasUnbind(new PrimitiveLiteral('')        )).to.equal(false);
    expect(hasUnbind(new Template([])                )).to.equal(false);
    expect(hasUnbind(new Unary('!', e)               )).to.equal(false);
    expect(hasUnbind(new CallScope('!', [])          )).to.equal(false);
    expect(hasUnbind(new CallMember(e, '', [])       )).to.equal(false);
    expect(hasUnbind(new CallFunction(e, [])         )).to.equal(false);
    expect(hasUnbind(new AccessMember(e, '')         )).to.equal(false);
    expect(hasUnbind(new AccessKeyed(e, e)           )).to.equal(false);
    expect(hasUnbind(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(hasUnbind(new Binary('+', e, e)           )).to.equal(false);
    expect(hasUnbind(new Conditional(e, e, e)        )).to.equal(false);
    expect(hasUnbind(new Assign(e, e)                )).to.equal(false);
    expect(hasUnbind(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(hasUnbind(new BindingBehavior(e, '', [])  )).to.equal(true);
    expect(hasUnbind(new HtmlLiteral([])             )).to.equal(false);
    expect(hasUnbind(new ArrayBindingPattern([])     )).to.equal(false);
    expect(hasUnbind(new ObjectBindingPattern([], []))).to.equal(false);
    expect(hasUnbind(new BindingIdentifier('')       )).to.equal(false);
    expect(hasUnbind(new ForOfStatement(e, e)        )).to.equal(true);
    expect(hasUnbind(new Interpolation([])           )).to.equal(false);
  });
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
it('hasUnbind', function () {
    expect(hasUnbind(new AccessThis()                )).to.equal(false);
    expect(hasUnbind(new AccessScope('')             )).to.equal(false);
    expect(hasUnbind(new ArrayLiteral([])            )).to.equal(false);
    expect(hasUnbind(new ObjectLiteral([], [])       )).to.equal(false);
    expect(hasUnbind(new PrimitiveLiteral('')        )).to.equal(false);
    expect(hasUnbind(new Template([])                )).to.equal(false);
    expect(hasUnbind(new Unary('!', e)               )).to.equal(false);
    expect(hasUnbind(new CallScope('!', [])          )).to.equal(false);
    expect(hasUnbind(new CallMember(e, '', [])       )).to.equal(false);
    expect(hasUnbind(new CallFunction(e, [])         )).to.equal(false);
    expect(hasUnbind(new AccessMember(e, '')         )).to.equal(false);
    expect(hasUnbind(new AccessKeyed(e, e)           )).to.equal(false);
    expect(hasUnbind(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(hasUnbind(new Binary('+', e, e)           )).to.equal(false);
    expect(hasUnbind(new Conditional(e, e, e)        )).to.equal(false);
    expect(hasUnbind(new Assign(e, e)                )).to.equal(false);
    expect(hasUnbind(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(hasUnbind(new BindingBehavior(e, '', [])  )).to.equal(true);
    expect(hasUnbind(new HtmlLiteral([])             )).to.equal(false);
    expect(hasUnbind(new ArrayBindingPattern([])     )).to.equal(false);
    expect(hasUnbind(new ObjectBindingPattern([], []))).to.equal(false);
    expect(hasUnbind(new BindingIdentifier('')       )).to.equal(false);
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
it('hasUnbind', function () {
    expect(hasUnbind(new AccessThis()                )).to.equal(false);
    expect(hasUnbind(new AccessScope('')             )).to.equal(false);
    expect(hasUnbind(new ArrayLiteral([])            )).to.equal(false);
    expect(hasUnbind(new ObjectLiteral([], [])       )).to.equal(false);
    expect(hasUnbind(new PrimitiveLiteral('')        )).to.equal(false);
    expect(hasUnbind(new Template([])                )).to.equal(false);
    expect(hasUnbind(new Unary('!', e)               )).to.equal(false);
    expect(hasUnbind(new CallScope('!', [])          )).to.equal(false);
    expect(hasUnbind(new CallMember(e, '', [])       )).to.equal(false);
    expect(hasUnbind(new CallFunction(e, [])         )).to.equal(false);
    expect(hasUnbind(new AccessMember(e, '')         )).to.equal(false);
    expect(hasUnbind(new AccessKeyed(e, e)           )).to.equal(false);
    expect(hasUnbind(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(hasUnbind(new Binary('+', e, e)           )).to.equal(false);
    expect(hasUnbind(new Conditional(e, e, e)        )).to.equal(false);
    expect(hasUnbind(new Assign(e, e)                )).to.equal(false);
    expect(hasUnbind(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(hasUnbind(new BindingBehavior(e, '', [])  )).to.equal(true);
    expect(hasUnbind(new HtmlLiteral([])             )).to.equal(false);
    expect(hasUnbind(new ArrayBindingPattern([])     )).to.equal(false);
    expect(hasUnbind(new ObjectBindingPattern([], []))).to.equal(false);
    expect(hasUnbind(new BindingIdentifier('')       )).to.equal(false);
    expect(hasUnbind(new ForOfStatement(e, e)        )).to.equal(true);
    expect(hasUnbind(new Interpolation([])           )).to.equal(false);
  });
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
expect(hasUnbind(new CallMember(e, '', [])       )).to.equal(false);
    expect(hasUnbind(new CallFunction(e, [])         )).to.equal(false);
    expect(hasUnbind(new AccessMember(e, '')         )).to.equal(false);
    expect(hasUnbind(new AccessKeyed(e, e)           )).to.equal(false);
    expect(hasUnbind(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(hasUnbind(new Binary('+', e, e)           )).to.equal(false);
    expect(hasUnbind(new Conditional(e, e, e)        )).to.equal(false);
    expect(hasUnbind(new Assign(e, e)                )).to.equal(false);
    expect(hasUnbind(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(hasUnbind(new BindingBehavior(e, '', [])  )).to.equal(true);
    expect(hasUnbind(new HtmlLiteral([])             )).to.equal(false);
    expect(hasUnbind(new ArrayBindingPattern([])     )).to.equal(false);
    expect(hasUnbind(new ObjectBindingPattern([], []))).to.equal(false);
    expect(hasUnbind(new BindingIdentifier('')       )).to.equal(false);
    expect(hasUnbind(new ForOfStatement(e, e)        )).to.equal(true);
    expect(hasUnbind(new Interpolation([])           )).to.equal(false);
  });
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
expect(hasUnbind(new PrimitiveLiteral('')        )).to.equal(false);
    expect(hasUnbind(new Template([])                )).to.equal(false);
    expect(hasUnbind(new Unary('!', e)               )).to.equal(false);
    expect(hasUnbind(new CallScope('!', [])          )).to.equal(false);
    expect(hasUnbind(new CallMember(e, '', [])       )).to.equal(false);
    expect(hasUnbind(new CallFunction(e, [])         )).to.equal(false);
    expect(hasUnbind(new AccessMember(e, '')         )).to.equal(false);
    expect(hasUnbind(new AccessKeyed(e, e)           )).to.equal(false);
    expect(hasUnbind(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(hasUnbind(new Binary('+', e, e)           )).to.equal(false);
    expect(hasUnbind(new Conditional(e, e, e)        )).to.equal(false);
    expect(hasUnbind(new Assign(e, e)                )).to.equal(false);
    expect(hasUnbind(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(hasUnbind(new BindingBehavior(e, '', [])  )).to.equal(true);
    expect(hasUnbind(new HtmlLiteral([])             )).to.equal(false);
    expect(hasUnbind(new ArrayBindingPattern([])     )).to.equal(false);
    expect(hasUnbind(new ObjectBindingPattern([], []))).to.equal(false);
    expect(hasUnbind(new BindingIdentifier('')       )).to.equal(false);
    expect(hasUnbind(new ForOfStatement(e, e)        )).to.equal(true);
    expect(hasUnbind(new Interpolation([])           )).to.equal(false);
  });