(source)
| 73 | } |
| 74 | |
| 75 | bind(source) { |
| 76 | if (this.isBound) { |
| 77 | if (this.source === source) { |
| 78 | return; |
| 79 | } |
| 80 | this.unbind(); |
| 81 | } |
| 82 | this.isBound = true; |
| 83 | this.source = source; |
| 84 | |
| 85 | if (this.sourceExpression.bind) { |
| 86 | this.sourceExpression.bind(this, source, this.lookupFunctions); |
| 87 | } |
| 88 | |
| 89 | let mode = this.mode; |
| 90 | if (!this.targetObserver) { |
| 91 | let method = mode === bindingMode.twoWay || mode === bindingMode.fromView ? 'getObserver' : 'getAccessor'; |
| 92 | this.targetObserver = this.observerLocator[method](this.target, this.targetProperty); |
| 93 | } |
| 94 | |
| 95 | if ('bind' in this.targetObserver) { |
| 96 | this.targetObserver.bind(); |
| 97 | } |
| 98 | if (this.mode !== bindingMode.fromView) { |
| 99 | let value = this.sourceExpression.evaluate(source, this.lookupFunctions); |
| 100 | this.updateTarget(value); |
| 101 | } |
| 102 | |
| 103 | if (mode === bindingMode.oneTime) { |
| 104 | return; |
| 105 | } else if (mode === bindingMode.toView) { |
| 106 | enqueueBindingConnect(this); |
| 107 | } else if (mode === bindingMode.twoWay) { |
| 108 | this.sourceExpression.connect(this, source); |
| 109 | this.targetObserver.subscribe(targetContext, this); |
| 110 | } else if (mode === bindingMode.fromView) { |
| 111 | this.targetObserver.subscribe(targetContext, this); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | unbind() { |
| 116 | if (!this.isBound) { |
nothing calls this directly
no test coverage detected