diff options
Diffstat (limited to '')
-rw-r--r-- | dom/webidl/WebTaskScheduling.webidl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dom/webidl/WebTaskScheduling.webidl b/dom/webidl/WebTaskScheduling.webidl new file mode 100644 index 0000000000..727484aa3f --- /dev/null +++ b/dom/webidl/WebTaskScheduling.webidl @@ -0,0 +1,43 @@ +enum TaskPriority { + "user-blocking", + "user-visible", + "background" +}; + +[Exposed=(Window, Worker), Pref="dom.enable_web_task_scheduling"] +interface TaskSignal : AbortSignal { + readonly attribute TaskPriority priority; + + attribute EventHandler onprioritychange; +}; + + +dictionary SchedulerPostTaskOptions { + AbortSignal signal; + TaskPriority priority; + [EnforceRange] unsigned long long delay = 0; +}; + +callback SchedulerPostTaskCallback = any (); + +[Exposed=(Window, Worker), Pref="dom.enable_web_task_scheduling"] +interface Scheduler { + [UseCounter] + Promise<any> postTask( + SchedulerPostTaskCallback callback, + optional SchedulerPostTaskOptions options = {} + ); +}; + +dictionary TaskControllerInit { + TaskPriority priority = "user-visible"; +}; + +[Exposed=(Window,Worker), Pref="dom.enable_web_task_scheduling"] +interface TaskController : AbortController { + [Throws] + constructor(optional TaskControllerInit init = {}); + + [Throws] + undefined setPriority(TaskPriority priority); +}; |