Comparing version 1.0.1-alpha.7 to 1.0.1-alpha.8
@@ -122,2 +122,3 @@ type BlacObserver<S> = (newState: S, oldState: S) => void | Promise<void>; | ||
registerIsolatedBlocInstance(bloc: BlocBase<any>): void; | ||
findIsolatedBlocInstance<B extends BlocBase<any>>(blocClass: BlocConstructor<B>, id: BlocInstanceId): InstanceType<BlocConstructor<B>> | undefined; | ||
unregisterIsolatedBlocInstance(bloc: BlocBase<any>): void; | ||
@@ -124,0 +125,0 @@ setCustomProps(blocClass: BlocBaseAbstract, props: BlocProps | undefined): void; |
@@ -197,2 +197,9 @@ /****************************************************************************** | ||
}; | ||
Blac.prototype.findIsolatedBlocInstance = function (blocClass, id) { | ||
var blocs = this.isolatedBlocMap.get(blocClass); | ||
if (blocs) { | ||
return blocs.find(function (b) { return b.id === id; }); | ||
} | ||
return undefined; | ||
}; | ||
Blac.prototype.unregisterIsolatedBlocInstance = function (bloc) { | ||
@@ -231,4 +238,8 @@ var blocClass = bloc.constructor; | ||
if (options === void 0) { options = {}; } | ||
var base = blocClass; | ||
var isIsolated = base.isolated; | ||
var id = options.id || blocClass.name; | ||
var registered = this.findRegisteredBlocInstance(blocClass, id); | ||
var registered = isIsolated | ||
? this.findIsolatedBlocInstance(blocClass, id) | ||
: this.findRegisteredBlocInstance(blocClass, id); | ||
var reconnect = options.reconnect; | ||
@@ -235,0 +246,0 @@ if (registered) { |
@@ -199,2 +199,9 @@ 'use strict'; | ||
}; | ||
Blac.prototype.findIsolatedBlocInstance = function (blocClass, id) { | ||
var blocs = this.isolatedBlocMap.get(blocClass); | ||
if (blocs) { | ||
return blocs.find(function (b) { return b.id === id; }); | ||
} | ||
return undefined; | ||
}; | ||
Blac.prototype.unregisterIsolatedBlocInstance = function (bloc) { | ||
@@ -233,4 +240,8 @@ var blocClass = bloc.constructor; | ||
if (options === void 0) { options = {}; } | ||
var base = blocClass; | ||
var isIsolated = base.isolated; | ||
var id = options.id || blocClass.name; | ||
var registered = this.findRegisteredBlocInstance(blocClass, id); | ||
var registered = isIsolated | ||
? this.findIsolatedBlocInstance(blocClass, id) | ||
: this.findRegisteredBlocInstance(blocClass, id); | ||
var reconnect = options.reconnect; | ||
@@ -237,0 +248,0 @@ if (registered) { |
{ | ||
"name": "blac", | ||
"version": "1.0.1-alpha.7", | ||
"version": "1.0.1-alpha.8", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/blac.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
89690
954