Skip to content

Commit

Permalink
fix(composition): use transient lifetime for composed view-models.
Browse files Browse the repository at this point in the history
Closes #22
  • Loading branch information
ckotzbauer committed Dec 17, 2017
1 parent c04ff7a commit 93a2892
Show file tree
Hide file tree
Showing 22 changed files with 84 additions and 70 deletions.
8 changes: 4 additions & 4 deletions dist/amd/knockout-bindable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
define(["require", "exports", "aurelia-binding", "aurelia-templating", "aurelia-dependency-injection", "knockout"], function (require, exports, aurelia_binding_1, aurelia_templating_1, aurelia_dependency_injection_1, ko) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var KnockoutBindable = (function () {
var KnockoutBindable = /** @class */ (function () {
function KnockoutBindable(observerLocator) {
this.subscriptions = [];
this.observerLocator = observerLocator;
Expand Down Expand Up @@ -58,10 +58,10 @@ define(["require", "exports", "aurelia-binding", "aurelia-templating", "aurelia-
KnockoutBindable.prototype.getObserver = function (target, key) {
return this.observerLocator.getObserver(target, key);
};
KnockoutBindable = __decorate([
aurelia_dependency_injection_1.inject(aurelia_binding_1.ObserverLocator)
], KnockoutBindable);
return KnockoutBindable;
}());
KnockoutBindable = __decorate([
aurelia_dependency_injection_1.inject(aurelia_binding_1.ObserverLocator)
], KnockoutBindable);
exports.KnockoutBindable = KnockoutBindable;
});
9 changes: 5 additions & 4 deletions dist/amd/knockout-composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ define(["require", "exports", "knockout", "aurelia-dependency-injection", "aurel
function loadModule(moduleId, loader) {
return loader.loadModule(moduleId);
}
var KnockoutComposition = (function () {
var KnockoutComposition = /** @class */ (function () {
function KnockoutComposition(compositionEngine, container, loader) {
this.compositionEngine = compositionEngine;
this.container = container;
Expand Down Expand Up @@ -162,13 +162,14 @@ define(["require", "exports", "knockout", "aurelia-dependency-injection", "aurel
return result;
}
}
_this.container.registerTransient(result);
return _this.container.get(result);
});
};
KnockoutComposition = __decorate([
aurelia_dependency_injection_1.inject(aurelia_templating_1.CompositionEngine, aurelia_dependency_injection_1.Container, aurelia_loader_1.Loader)
], KnockoutComposition);
return KnockoutComposition;
}());
KnockoutComposition = __decorate([
aurelia_dependency_injection_1.inject(aurelia_templating_1.CompositionEngine, aurelia_dependency_injection_1.Container, aurelia_loader_1.Loader)
], KnockoutComposition);
exports.KnockoutComposition = KnockoutComposition;
});
10 changes: 5 additions & 5 deletions dist/amd/knockout-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define(["require", "exports", "aurelia-dependency-injection", "aurelia-templatin
}
return null;
}
var KnockoutCustomAttribute = (function () {
var KnockoutCustomAttribute = /** @class */ (function () {
function KnockoutCustomAttribute(element) {
this.element = element;
}
Expand Down Expand Up @@ -51,11 +51,11 @@ define(["require", "exports", "aurelia-dependency-injection", "aurelia-templatin
KnockoutCustomAttribute.prototype.unbind = function () {
ko.cleanNode(this.element);
};
KnockoutCustomAttribute = __decorate([
aurelia_templating_1.customAttribute('knockout'),
aurelia_dependency_injection_1.inject(Element)
], KnockoutCustomAttribute);
return KnockoutCustomAttribute;
}());
KnockoutCustomAttribute = __decorate([
aurelia_templating_1.customAttribute('knockout'),
aurelia_dependency_injection_1.inject(Element)
], KnockoutCustomAttribute);
exports.KnockoutCustomAttribute = KnockoutCustomAttribute;
});
8 changes: 4 additions & 4 deletions dist/amd/require-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
define(["require", "exports", "aurelia-loader", "aurelia-dependency-injection"], function (require, exports, aurelia_loader_1, aurelia_dependency_injection_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RequirePolyfill = (function () {
var RequirePolyfill = /** @class */ (function () {
function RequirePolyfill(loader) {
this.loader = loader;
}
Expand Down Expand Up @@ -44,10 +44,10 @@ define(["require", "exports", "aurelia-loader", "aurelia-dependency-injection"],
};
}
};
RequirePolyfill = __decorate([
aurelia_dependency_injection_1.inject(aurelia_loader_1.Loader)
], RequirePolyfill);
return RequirePolyfill;
}());
RequirePolyfill = __decorate([
aurelia_dependency_injection_1.inject(aurelia_loader_1.Loader)
], RequirePolyfill);
exports.RequirePolyfill = RequirePolyfill;
});
8 changes: 4 additions & 4 deletions dist/commonjs/knockout-bindable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var aurelia_binding_1 = require("aurelia-binding");
var aurelia_templating_1 = require("aurelia-templating");
var aurelia_dependency_injection_1 = require("aurelia-dependency-injection");
var ko = require("knockout");
var KnockoutBindable = (function () {
var KnockoutBindable = /** @class */ (function () {
function KnockoutBindable(observerLocator) {
this.subscriptions = [];
this.observerLocator = observerLocator;
Expand Down Expand Up @@ -61,9 +61,9 @@ var KnockoutBindable = (function () {
KnockoutBindable.prototype.getObserver = function (target, key) {
return this.observerLocator.getObserver(target, key);
};
KnockoutBindable = __decorate([
aurelia_dependency_injection_1.inject(aurelia_binding_1.ObserverLocator)
], KnockoutBindable);
return KnockoutBindable;
}());
KnockoutBindable = __decorate([
aurelia_dependency_injection_1.inject(aurelia_binding_1.ObserverLocator)
], KnockoutBindable);
exports.KnockoutBindable = KnockoutBindable;
9 changes: 5 additions & 4 deletions dist/commonjs/knockout-composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function processInstruction(instruction) {
function loadModule(moduleId, loader) {
return loader.loadModule(moduleId);
}
var KnockoutComposition = (function () {
var KnockoutComposition = /** @class */ (function () {
function KnockoutComposition(compositionEngine, container, loader) {
this.compositionEngine = compositionEngine;
this.container = container;
Expand Down Expand Up @@ -165,12 +165,13 @@ var KnockoutComposition = (function () {
return result;
}
}
_this.container.registerTransient(result);
return _this.container.get(result);
});
};
KnockoutComposition = __decorate([
aurelia_dependency_injection_1.inject(aurelia_templating_1.CompositionEngine, aurelia_dependency_injection_1.Container, aurelia_loader_1.Loader)
], KnockoutComposition);
return KnockoutComposition;
}());
KnockoutComposition = __decorate([
aurelia_dependency_injection_1.inject(aurelia_templating_1.CompositionEngine, aurelia_dependency_injection_1.Container, aurelia_loader_1.Loader)
], KnockoutComposition);
exports.KnockoutComposition = KnockoutComposition;
10 changes: 5 additions & 5 deletions dist/commonjs/knockout-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getFirstBoundChild(rootNode) {
}
return null;
}
var KnockoutCustomAttribute = (function () {
var KnockoutCustomAttribute = /** @class */ (function () {
function KnockoutCustomAttribute(element) {
this.element = element;
}
Expand Down Expand Up @@ -53,10 +53,10 @@ var KnockoutCustomAttribute = (function () {
KnockoutCustomAttribute.prototype.unbind = function () {
ko.cleanNode(this.element);
};
KnockoutCustomAttribute = __decorate([
aurelia_templating_1.customAttribute('knockout'),
aurelia_dependency_injection_1.inject(Element)
], KnockoutCustomAttribute);
return KnockoutCustomAttribute;
}());
KnockoutCustomAttribute = __decorate([
aurelia_templating_1.customAttribute('knockout'),
aurelia_dependency_injection_1.inject(Element)
], KnockoutCustomAttribute);
exports.KnockoutCustomAttribute = KnockoutCustomAttribute;
8 changes: 4 additions & 4 deletions dist/commonjs/require-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Object.defineProperty(exports, "__esModule", { value: true });
var aurelia_loader_1 = require("aurelia-loader");
var aurelia_dependency_injection_1 = require("aurelia-dependency-injection");
var RequirePolyfill = (function () {
var RequirePolyfill = /** @class */ (function () {
function RequirePolyfill(loader) {
this.loader = loader;
}
Expand Down Expand Up @@ -45,9 +45,9 @@ var RequirePolyfill = (function () {
};
}
};
RequirePolyfill = __decorate([
aurelia_dependency_injection_1.inject(aurelia_loader_1.Loader)
], RequirePolyfill);
return RequirePolyfill;
}());
RequirePolyfill = __decorate([
aurelia_dependency_injection_1.inject(aurelia_loader_1.Loader)
], RequirePolyfill);
exports.RequirePolyfill = RequirePolyfill;
1 change: 1 addition & 0 deletions dist/es2015/knockout-composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ let KnockoutComposition = class KnockoutComposition {
return result;
}
}
this.container.registerTransient(result);
return this.container.get(result);
});
}
Expand Down
1 change: 1 addition & 0 deletions dist/es2017/knockout-composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ let KnockoutComposition = class KnockoutComposition {
return result;
}
}
this.container.registerTransient(result);
return this.container.get(result);
});
}
Expand Down
8 changes: 4 additions & 4 deletions dist/native-modules/knockout-bindable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ObserverLocator } from 'aurelia-binding';
import { BehaviorPropertyObserver } from 'aurelia-templating';
import { inject } from 'aurelia-dependency-injection';
import * as ko from 'knockout';
var KnockoutBindable = (function () {
var KnockoutBindable = /** @class */ (function () {
function KnockoutBindable(observerLocator) {
this.subscriptions = [];
this.observerLocator = observerLocator;
Expand Down Expand Up @@ -59,9 +59,9 @@ var KnockoutBindable = (function () {
KnockoutBindable.prototype.getObserver = function (target, key) {
return this.observerLocator.getObserver(target, key);
};
KnockoutBindable = __decorate([
inject(ObserverLocator)
], KnockoutBindable);
return KnockoutBindable;
}());
KnockoutBindable = __decorate([
inject(ObserverLocator)
], KnockoutBindable);
export { KnockoutBindable };
9 changes: 5 additions & 4 deletions dist/native-modules/knockout-composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function processInstruction(instruction) {
function loadModule(moduleId, loader) {
return loader.loadModule(moduleId);
}
var KnockoutComposition = (function () {
var KnockoutComposition = /** @class */ (function () {
function KnockoutComposition(compositionEngine, container, loader) {
this.compositionEngine = compositionEngine;
this.container = container;
Expand Down Expand Up @@ -163,12 +163,13 @@ var KnockoutComposition = (function () {
return result;
}
}
_this.container.registerTransient(result);
return _this.container.get(result);
});
};
KnockoutComposition = __decorate([
inject(CompositionEngine, Container, Loader)
], KnockoutComposition);
return KnockoutComposition;
}());
KnockoutComposition = __decorate([
inject(CompositionEngine, Container, Loader)
], KnockoutComposition);
export { KnockoutComposition };
10 changes: 5 additions & 5 deletions dist/native-modules/knockout-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getFirstBoundChild(rootNode) {
}
return null;
}
var KnockoutCustomAttribute = (function () {
var KnockoutCustomAttribute = /** @class */ (function () {
function KnockoutCustomAttribute(element) {
this.element = element;
}
Expand Down Expand Up @@ -51,10 +51,10 @@ var KnockoutCustomAttribute = (function () {
KnockoutCustomAttribute.prototype.unbind = function () {
ko.cleanNode(this.element);
};
KnockoutCustomAttribute = __decorate([
customAttribute('knockout'),
inject(Element)
], KnockoutCustomAttribute);
return KnockoutCustomAttribute;
}());
KnockoutCustomAttribute = __decorate([
customAttribute('knockout'),
inject(Element)
], KnockoutCustomAttribute);
export { KnockoutCustomAttribute };
8 changes: 4 additions & 4 deletions dist/native-modules/require-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
import { Loader } from 'aurelia-loader';
import { inject } from 'aurelia-dependency-injection';
var RequirePolyfill = (function () {
var RequirePolyfill = /** @class */ (function () {
function RequirePolyfill(loader) {
this.loader = loader;
}
Expand Down Expand Up @@ -43,9 +43,9 @@ var RequirePolyfill = (function () {
};
}
};
RequirePolyfill = __decorate([
inject(Loader)
], RequirePolyfill);
return RequirePolyfill;
}());
RequirePolyfill = __decorate([
inject(Loader)
], RequirePolyfill);
export { RequirePolyfill };
8 changes: 4 additions & 4 deletions dist/system/knockout-bindable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ System.register(["aurelia-binding", "aurelia-templating", "aurelia-dependency-in
}
],
execute: function () {
KnockoutBindable = (function () {
KnockoutBindable = /** @class */ (function () {
function KnockoutBindable(observerLocator) {
this.subscriptions = [];
this.observerLocator = observerLocator;
Expand Down Expand Up @@ -75,11 +75,11 @@ System.register(["aurelia-binding", "aurelia-templating", "aurelia-dependency-in
KnockoutBindable.prototype.getObserver = function (target, key) {
return this.observerLocator.getObserver(target, key);
};
KnockoutBindable = __decorate([
aurelia_dependency_injection_1.inject(aurelia_binding_1.ObserverLocator)
], KnockoutBindable);
return KnockoutBindable;
}());
KnockoutBindable = __decorate([
aurelia_dependency_injection_1.inject(aurelia_binding_1.ObserverLocator)
], KnockoutBindable);
exports_1("KnockoutBindable", KnockoutBindable);
}
};
Expand Down
9 changes: 5 additions & 4 deletions dist/system/knockout-composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ System.register(["knockout", "aurelia-dependency-injection", "aurelia-loader", "
}
],
execute: function () {
KnockoutComposition = (function () {
KnockoutComposition = /** @class */ (function () {
function KnockoutComposition(compositionEngine, container, loader) {
this.compositionEngine = compositionEngine;
this.container = container;
Expand Down Expand Up @@ -179,14 +179,15 @@ System.register(["knockout", "aurelia-dependency-injection", "aurelia-loader", "
return result;
}
}
_this.container.registerTransient(result);
return _this.container.get(result);
});
};
KnockoutComposition = __decorate([
aurelia_dependency_injection_1.inject(aurelia_templating_1.CompositionEngine, aurelia_dependency_injection_1.Container, aurelia_loader_1.Loader)
], KnockoutComposition);
return KnockoutComposition;
}());
KnockoutComposition = __decorate([
aurelia_dependency_injection_1.inject(aurelia_templating_1.CompositionEngine, aurelia_dependency_injection_1.Container, aurelia_loader_1.Loader)
], KnockoutComposition);
exports_1("KnockoutComposition", KnockoutComposition);
}
};
Expand Down
10 changes: 5 additions & 5 deletions dist/system/knockout-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ System.register(["aurelia-dependency-injection", "aurelia-templating", "knockout
}
],
execute: function () {
KnockoutCustomAttribute = (function () {
KnockoutCustomAttribute = /** @class */ (function () {
function KnockoutCustomAttribute(element) {
this.element = element;
}
Expand Down Expand Up @@ -65,12 +65,12 @@ System.register(["aurelia-dependency-injection", "aurelia-templating", "knockout
KnockoutCustomAttribute.prototype.unbind = function () {
ko.cleanNode(this.element);
};
KnockoutCustomAttribute = __decorate([
aurelia_templating_1.customAttribute('knockout'),
aurelia_dependency_injection_1.inject(Element)
], KnockoutCustomAttribute);
return KnockoutCustomAttribute;
}());
KnockoutCustomAttribute = __decorate([
aurelia_templating_1.customAttribute('knockout'),
aurelia_dependency_injection_1.inject(Element)
], KnockoutCustomAttribute);
exports_1("KnockoutCustomAttribute", KnockoutCustomAttribute);
}
};
Expand Down
Loading

0 comments on commit 93a2892

Please sign in to comment.