@ionic/angular
Version:
Angular specific wrappers for @ionic/core
44 lines • 1.48 kB
JavaScript
import { Injectable, InjectionToken } from '@angular/core';
import * as i0 from "@angular/core";
export class Config {
get(key, fallback) {
const c = getConfig();
if (c) {
return c.get(key, fallback);
}
return null;
}
getBoolean(key, fallback) {
const c = getConfig();
if (c) {
return c.getBoolean(key, fallback);
}
return false;
}
getNumber(key, fallback) {
const c = getConfig();
if (c) {
return c.getNumber(key, fallback);
}
return 0;
}
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: Config, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: Config, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: Config, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}] });
export const ConfigToken = new InjectionToken('USERCONFIG');
const getConfig = () => {
if (typeof window !== 'undefined') {
const Ionic = window.Ionic;
if (Ionic?.config) {
return Ionic.config;
}
}
return null;
};
//# sourceMappingURL=config.js.map