fix(): fixed failing test

This commit is contained in:
Torkel Ödegaard 2016-03-25 15:52:28 +01:00
parent 61017fc204
commit 319b934967

View File

@ -21,13 +21,13 @@ export class Emitter {
this.subjects[fnName].next(data); this.subjects[fnName].next(data);
} }
on(name, handler, $scope) { on(name, handler, scope?) {
var fnName = createName(name); var fnName = createName(name);
this.subjects[fnName] || (this.subjects[fnName] = new Subject()); this.subjects[fnName] || (this.subjects[fnName] = new Subject());
var subscription = this.subjects[fnName].subscribe(handler); var subscription = this.subjects[fnName].subscribe(handler);
if ($scope) { if (scope) {
$scope.$on('$destroy', function() { scope.$on('$destroy', function() {
subscription.unsubscribe(); subscription.unsubscribe();
}); });
} }