TaskPriorityChangeEvent
Prioritized Task Scheduling API
Prioritized Task Scheduling API
The **`TaskPriorityChangeEvent`** is the interface for the [`prioritychange`](/docs/Web/API/TaskSignal/prioritychange_event) event.
## Constructor
- TaskPriorityChangeEvent()
- : Creates a new `TaskPriorityChangeEvent` object, setting an event name and previous priority.
## Instance properties
_This interface also inherits the properties of its parent, Event._
- TaskPriorityChangeEvent.previousPriority
- : Returns the [priority](/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) of the corresponding TaskSignal _before_ this [`prioritychange`](/docs/Web/API/TaskSignal/prioritychange_event) event.
## 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.
```js
// 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](/docs/Web/API/TaskSignal/prioritychange_event).
## Specifications
## Browser compatibility
## See also
- [`prioritychange`](/docs/Web/API/TaskSignal/prioritychange_event) event
Cite this
"TaskPriorityChangeEvent". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy