[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Task](https://evolu.dev/docs/api-reference/common/Task) › prioritized

```ts
function prioritized<T, E, D>(
  priority: TaskPriority,
  task: Task<T, E, D>,
): Task<T, E, D>;
```

Defined in: [packages/common/src/Task.ts:4775](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Task.ts#L4775)

Assigns static scheduler priority to a [Task](https://evolu.dev/docs/api-reference/common/Task/type-aliases/Task).

[Run](https://evolu.dev/docs/api-reference/common/Task/interfaces/Run) uses the priority with native `scheduler.postTask` when available.
Platforms without the Scheduler API run the Task normally. Use a Scheduler
API polyfill such as
[scheduler-polyfill](https://github.com/GoogleChromeLabs/scheduler-polyfill)
for hosts like Safari and React Native when priority-aware scheduling is
needed.

`scheduler.postTask` must reject queued aborts with `AbortSignal.reason`.
Other host-specific abort objects are treated as defects.

### Example

```ts

const rebuildSearchIndex: Task<string> = () => ok("indexed");
const backgroundIndexing = prioritized("background", rebuildSearchIndex);

await using run = createRun();
assertOk(await run(backgroundIndexing), "indexed");
```