Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public registerRegion(regionName: string, onAddingViewToRegionCallback: ViewCallBack, onRemovingFromRegionCallback: ViewCallBack) {
Guard.stringIsNotEmpty(regionName, 'region name required');
Guard.isFunction(onAddingViewToRegionCallback, 'onAddingViewToRegionCallback must be a function');
Guard.isFunction(onRemovingFromRegionCallback, 'onRemovingFromRegionCallback must be a function');
_log.debug('registering region {0}', regionName);
if (this._regions[regionName]) {
let message = `Cannot register region ${regionName} as it is already registered`;
_log.error(message);
throw new Error(message);
}
this._regions[regionName] = {
onAdding: onAddingViewToRegionCallback,
onRemoving: onRemovingFromRegionCallback
};
}
public registerRegion(regionName: string, onAddingViewToRegionCallback: ViewCallBack, onRemovingFromRegionCallback: ViewCallBack) {
Guard.stringIsNotEmpty(regionName, 'region name required');
Guard.isFunction(onAddingViewToRegionCallback, 'onAddingViewToRegionCallback must be a function');
Guard.isFunction(onRemovingFromRegionCallback, 'onRemovingFromRegionCallback must be a function');
_log.debug('registering region {0}', regionName);
if (this._regions[regionName]) {
let message = `Cannot register region ${regionName} as it is already registered`;
_log.error(message);
throw new Error(message);
}
this._regions[regionName] = {
onAdding: onAddingViewToRegionCallback,
onRemoving: onRemovingFromRegionCallback
};
}