How to use the esp-js.Guard.stringIsNotEmpty function in esp-js

To help you get started, we’ve selected a few esp-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esp / esp-js / packages / esp-js-ui / src / ui / regions / regionManager.ts View on Github external
public addToRegion(regionName: string, modelId:string, displayOptions?: DisplayOptions): RegionItem {
        // I'm not dispatching this call onto the router as by design this model doesn't really have any true observers.
        // It does listen to events, but nothing should render it's state, thus this call is synchronous

        Guard.stringIsNotEmpty(regionName, 'region name required');
        Guard.stringIsNotEmpty(modelId, 'modelId must be defined');
        let regionItem = new RegionItem(modelId, displayOptions);
        this._addToRegion(regionName, regionItem);
        return regionItem;
    }
github esp / esp-js / packages / esp-js-ui / src / ui / regions / regionManager.ts View on Github external
public addToRegion(regionName: string, modelId:string, displayOptions?: DisplayOptions): RegionItem {
        // I'm not dispatching this call onto the router as by design this model doesn't really have any true observers.
        // It does listen to events, but nothing should render it's state, thus this call is synchronous

        Guard.stringIsNotEmpty(regionName, 'region name required');
        Guard.stringIsNotEmpty(modelId, 'modelId must be defined');
        let regionItem = new RegionItem(modelId, displayOptions);
        this._addToRegion(regionName, regionItem);
        return regionItem;
    }
github esp / esp-js / packages / esp-js-ui / src / ui / regions / regionManager.ts View on Github external
public removeFromRegion(regionName: string, regionItem: RegionItem): void {
        Guard.stringIsNotEmpty(regionName, 'region name required');
        Guard.isDefined(regionItem, 'regionItem must be defined');
        _log.debug(`Removing from region ${regionName}. ${regionItem.toString()}.`);
        if (!(regionName in this._regions)) {
            let message = `Cannot remove from region ${regionName} as the region is not registered. ${regionItem}`;
            _log.error(message);
            throw new Error(message);
        }
        this._regions[regionName].onRemoving(regionItem);
    }
}
github esp / esp-js / packages / esp-js-polimer / src / eventTransformations.ts View on Github external
return function (target, name, descriptor) {
        Guard.stringIsNotEmpty(eventType, 'eventType passed to an eventTransformFor decorator must not be \'\'');
        let metadata: EspMetadata  = EspDecoratorUtil.getOrCreateMetaData(target.constructor);
        metadata.addEvent(
            name,
            eventType,
            DecoratorTypes.custom,
            observationStage,
            null
        );
        return descriptor;
    };
}
github esp / esp-js / packages / esp-js-polimer / src / decorators.ts View on Github external
return function (target, name, descriptor) {
        Guard.stringIsNotEmpty(eventType, 'eventType passed to an observeStoreEvent decorator must not be \'\'');
        let metadata: EspMetadata  = EspDecoratorUtil.getOrCreateMetaData(target.constructor);
        metadata.addEvent(
            name,
            eventType,
            DecoratorTypes.custom,
            observationStage,
            null
        );
        return descriptor;
    };
}
github esp / esp-js / packages / esp-js-polimer / src / polimerModel.ts View on Github external
constructor(
        private readonly _router: Router,
        private _store: TStore,
        private readonly _stateHandlerMaps: Map>,
        private readonly _stateHandlerObjects: Map,
        private readonly _eventStreamFactories: OutputEventStreamFactory[],
        private readonly _eventStreamHandlerObjects: any[]
    ) {
        super();
        Guard.isDefined(_router, 'router must be defined');
        Guard.isObject(_store, 'store must be defined and be an object');
        Guard.stringIsNotEmpty(_store.modelId, `Initial store's modelId must not be null or empty`);
        this._modelId = _store.modelId;
    }
github esp / esp-js / packages / esp-js-ui / src / ui / regions / regionManager.ts View on Github external
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
        };
    }