@ionic/angular
Version:
Angular specific wrappers for @ionic/core
44 lines • 1.61 kB
JavaScript
import { Injectable } from '@angular/core';
import * as i0 from "@angular/core";
export class DomController {
/**
* Schedules a task to run during the READ phase of the next frame.
* This task should only read the DOM, but never modify it.
*/
read(cb) {
getQueue().read(cb);
}
/**
* Schedules a task to run during the WRITE phase of the next frame.
* This task should write the DOM, but never READ it.
*/
write(cb) {
getQueue().write(cb);
}
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: DomController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: DomController, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: DomController, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}] });
const getQueue = () => {
const win = typeof window !== 'undefined' ? window : null;
if (win != null) {
const Ionic = win.Ionic;
if (Ionic?.queue) {
return Ionic.queue;
}
return {
read: (cb) => win.requestAnimationFrame(cb),
write: (cb) => win.requestAnimationFrame(cb),
};
}
return {
read: (cb) => cb(),
write: (cb) => cb(),
};
};
//# sourceMappingURL=dom-controller.js.map