mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 18:17:31 +08:00
28 lines
516 B
TypeScript
28 lines
516 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable()
|
|
export class DomController {
|
|
|
|
read(cb: RafCallback) {
|
|
getQueue().read(cb);
|
|
}
|
|
|
|
write(cb: RafCallback) {
|
|
getQueue().write(cb);
|
|
}
|
|
}
|
|
|
|
function getQueue() {
|
|
const Ionic = (window as any).Ionic;
|
|
if (Ionic && Ionic.queue) {
|
|
return Ionic.queue;
|
|
}
|
|
|
|
return {
|
|
read: (cb: any) => window.requestAnimationFrame(cb),
|
|
write: (cb: any) => window.requestAnimationFrame(cb)
|
|
};
|
|
}
|
|
|
|
export type RafCallback = { (timeStamp?: number): void };
|