Created
November 22, 2017 08:30
-
-
Save Opiskull/0ce807ee3f987d4cb7ce098f9ce0ac03 to your computer and use it in GitHub Desktop.
Revisions
-
Opiskull created this gist
Nov 22, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import { Repeat, RepeatStrategyLocator } from "aurelia-templating-resources"; export class PromiseRepeatStrategy { constructor(private repeatStrategyLocator: RepeatStrategyLocator) { } instanceChanged(repeat: Repeat, promise: any): void { promise.then((items) => { const strategy = this.repeatStrategyLocator.getStrategy(items); if (!strategy) { throw new Error("Value for \'" + items + "\' is non-repeatable"); } strategy.instanceChanged(repeat, items); }); } instanceMutated(repeat: Repeat, promise: any, changes: any): void { promise.then((items) => { const strategy = this.repeatStrategyLocator.getStrategy(items); if (!strategy) { throw new Error("Value for \'" + items + "\' is non-repeatable"); } strategy.instanceMutated(repeat, items, changes); }); } getCollectionObserver(observerLocator: any, items: any): any { } }