mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
28 lines
514 B
TypeScript
28 lines
514 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;
|