Skip to content

Commit 447ae13

Browse files
authored
Reference splitTask from interactivity package in docs
1 parent 1c698f8 commit 447ae13

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

docs/reference-guides/interactivity-api/api-reference.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,12 +878,7 @@ You may want to add multiple such `yield` points in your action if it is doing a
878878
As mentioned above with [`wp-on`](#wp-on), [`wp-on-window`](#wp-on-window), and [`wp-on-document`](#wp-on-document), an async action should be used whenever the `async` versions of the aforementioned directives cannot be used due to the action requiring synchronous access to the `event` object. Synchronous access is required whenever the action needs to call `event.preventDefault()`, `event.stopPropagation()`, or `event.stopImmediatePropagation()`. To ensure that the action code does not contribute to a long task, you may manually yield to the main thread after calling the synchronous event API. For example:
879879

880880
```js
881-
// Note: In WordPress 6.6 this splitTask function is exported by @wordpress/interactivity.
882-
function splitTask() {
883-
return new Promise( ( resolve ) => {
884-
setTimeout( resolve, 0 );
885-
} );
886-
}
881+
import { splitTask } from '@wordpress/interactivity';
887882

888883
store( 'myPlugin', {
889884
actions: {

0 commit comments

Comments
 (0)