Skip to content

Commit

Permalink
feat(InterpolationBinding): add method to update one-time children
Browse files Browse the repository at this point in the history
related to #301
  • Loading branch information
jdanyow committed Feb 10, 2016
1 parent bc0aa92 commit 243aa75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/interpolation-binding-expression.js
Expand Up @@ -69,6 +69,15 @@ export class InterpolationBinding {
}
}

updateOneTimeBindings() {
for (let i = 1, ii = this.parts.length; i < ii; i += 2) {
let child = this[`childBinding${i}`];
if (child.mode === bindingMode.oneTime) {
child.call();
}
}
}

bind(source) {
if (this.isBound) {
if (this.source === source) {
Expand Down
4 changes: 4 additions & 0 deletions test/interpolation-binding.spec.js
Expand Up @@ -169,6 +169,10 @@ describe('InterpolationBinding', () => {
expect(observer1.hasSubscribers()).toBe(false);
expect(binding.source).toBe(null);
});

it('has an updateOneTimeBindings method', () => {
binding.updateOneTimeBindings();
});
});

describe('repeated expressions', () => {
Expand Down

0 comments on commit 243aa75

Please sign in to comment.