Prioritized Task Scheduling API
The TaskPriorityChangeEvent is the interface for the prioritychange event.
Constructor
- TaskPriorityChangeEvent.TaskPriorityChangeEvent
- : Creates a new
TaskPriorityChangeEventobject, setting an event name and previous priority.
- : Creates a new
Instance properties
This interface also inherits the properties of its parent, Event.
- TaskPriorityChangeEvent.previousPriority
- : Returns the priority of the corresponding TaskSignal before this
prioritychangeevent.
- : Returns the priority of the corresponding TaskSignal before this
Instance methods
This interface has no methods of its own, but inherits the methods of its parent, Event.
Examples
An object of this type is returned in the handler for a prioritychange event.
The code below shows a handler in which the newPriority and previousPriority are logged.
// Listen for 'prioritychange' events on the controller's signal.
controller.signal.addEventListener("prioritychange", (event) => {
const previousPriority = event.previousPriority;
const newPriority = event.target.priority;
console.log(`Priority changed from ${previousPriority} to ${newPriority}.`);
});
A more complete live example can be found in prioritychange event > Examples.
Specifications
Browser compatibility
See also
prioritychangeevent
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
