@progress/kendo-angular-map
Version:
Kendo UI Map for Angular
63 lines (62 loc) • 2.09 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Injectable, NgZone } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import * as i0 from "@angular/core";
/**
* @hidden
*/
export class Change {
key;
value;
constructor(key, value) {
this.key = key;
this.value = value;
}
}
/**
* @hidden
*/
export class ConfigurationService {
ngZone;
changes;
store = {};
source = new BehaviorSubject({});
constructor(ngZone) {
this.ngZone = ngZone;
this.initSource();
}
initSource() {
this.changes = this.source.asObservable();
}
push(store) {
this.store = store;
this.next();
}
notify(change) {
this.set(change.key, change.value);
this.next();
}
set(field, value) {
let store = this.store;
const parts = field.split('.');
let key = parts.shift();
while (parts.length > 0) {
store = store[key] = store[key] || {};
key = parts.shift();
}
store[key] = value;
}
next() {
this.ngZone.runOutsideAngular(() => {
this.source.next(this.store);
});
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigurationService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigurationService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigurationService, decorators: [{
type: Injectable
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });