mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] scheduler: capture requestAnimationFrame asap
This is useful to prevent interactions with other testing code.
This commit is contained in:
committed by
Samuel Degueldre
parent
9a54afcdf5
commit
8e36a11b6e
+1
-1
@@ -25,7 +25,7 @@ export class App<T extends typeof Component = any> extends TemplateSet {
|
|||||||
Root: T;
|
Root: T;
|
||||||
props: any;
|
props: any;
|
||||||
env: Env;
|
env: Env;
|
||||||
scheduler = new Scheduler(window.requestAnimationFrame.bind(window));
|
scheduler = new Scheduler();
|
||||||
root: ComponentNode | null = null;
|
root: ComponentNode | null = null;
|
||||||
|
|
||||||
constructor(Root: T, config: AppConfig = {}) {
|
constructor(Root: T, config: AppConfig = {}) {
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import { STATUS } from "./status";
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
export class Scheduler {
|
export class Scheduler {
|
||||||
|
// capture the value of requestAnimationFrame as soon as possible, to avoid
|
||||||
|
// interactions with other code, such as test frameworks that override them
|
||||||
|
static requestAnimationFrame = window.requestAnimationFrame.bind(this);
|
||||||
tasks: Set<RootFiber> = new Set();
|
tasks: Set<RootFiber> = new Set();
|
||||||
isRunning: boolean = false;
|
isRunning: boolean = false;
|
||||||
requestAnimationFrame: Window["requestAnimationFrame"];
|
requestAnimationFrame: Window["requestAnimationFrame"];
|
||||||
|
|
||||||
constructor(requestAnimationFrame: Window["requestAnimationFrame"]) {
|
constructor() {
|
||||||
this.requestAnimationFrame = requestAnimationFrame;
|
this.requestAnimationFrame = requestAnimationFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user