@wordpress/interactivity
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -14,3 +14,3 @@ // eslint-disable-next-line eslint-comments/disable-enable-pair | ||
*/ | ||
import { useWatch, useInit, kebabToCamelCase, warn, yieldToMain } from './utils'; | ||
import { useWatch, useInit, kebabToCamelCase, warn, splitTask } from './utils'; | ||
import { directive, getScope, getEvaluate } from './hooks'; | ||
@@ -214,3 +214,3 @@ | ||
const cb = async event => { | ||
await yieldToMain(); | ||
await splitTask(); | ||
evaluate(entry, event); | ||
@@ -354,3 +354,3 @@ }; | ||
entries.forEach(async entry => { | ||
await yieldToMain(); | ||
await splitTask(); | ||
evaluate(entry, event); | ||
@@ -357,0 +357,0 @@ }); |
@@ -19,3 +19,3 @@ /** | ||
export { getContext, getElement } from './hooks'; | ||
export { withScope, useWatch, useInit, useEffect, useLayoutEffect, useCallback, useMemo } from './utils'; | ||
export { withScope, useWatch, useInit, useEffect, useLayoutEffect, useCallback, useMemo, splitTask } from './utils'; | ||
export { useState, useRef } from 'preact/hooks'; | ||
@@ -22,0 +22,0 @@ const requiredConsent = 'I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.'; |
@@ -9,3 +9,3 @@ /** | ||
import { toVdom, hydratedIslands } from './vdom'; | ||
import { createRootFragment, yieldToMain } from './utils'; | ||
import { createRootFragment, splitTask } from './utils'; | ||
import { directivePrefix } from './constants'; | ||
@@ -33,7 +33,7 @@ | ||
if (!hydratedIslands.has(node)) { | ||
await yieldToMain(); | ||
await splitTask(); | ||
const fragment = getRegionRootFragment(node); | ||
const vdom = toVdom(node); | ||
initialVdom.set(node, vdom); | ||
await yieldToMain(); | ||
await splitTask(); | ||
hydrate(vdom, fragment); | ||
@@ -40,0 +40,0 @@ } |
@@ -37,3 +37,3 @@ /** | ||
*/ | ||
export const yieldToMain = () => { | ||
export const splitTask = () => { | ||
return new Promise(resolve => { | ||
@@ -40,0 +40,0 @@ // TODO: Use scheduler.yield() when available. |
export { store, getConfig } from './store'; | ||
export { getContext, getElement } from './hooks'; | ||
export { withScope, useWatch, useInit, useEffect, useLayoutEffect, useCallback, useMemo, } from './utils'; | ||
export { withScope, useWatch, useInit, useEffect, useLayoutEffect, useCallback, useMemo, splitTask, } from './utils'; | ||
export { useState, useRef } from 'preact/hooks'; | ||
export declare const privateApis: (lock: any) => any; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare const yieldToMain: () => Promise<unknown>; | ||
export declare const splitTask: () => Promise<unknown>; | ||
/** | ||
@@ -13,0 +13,0 @@ * Custom hook that executes a callback function whenever a signal is triggered. |
@@ -219,3 +219,3 @@ "use strict"; | ||
const cb = async event => { | ||
await (0, _utils.yieldToMain)(); | ||
await (0, _utils.splitTask)(); | ||
evaluate(entry, event); | ||
@@ -359,3 +359,3 @@ }; | ||
entries.forEach(async entry => { | ||
await (0, _utils.yieldToMain)(); | ||
await (0, _utils.splitTask)(); | ||
evaluate(entry, event); | ||
@@ -362,0 +362,0 @@ }); |
@@ -26,2 +26,8 @@ "use strict"; | ||
exports.privateApis = void 0; | ||
Object.defineProperty(exports, "splitTask", { | ||
enumerable: true, | ||
get: function () { | ||
return _utils.splitTask; | ||
} | ||
}); | ||
Object.defineProperty(exports, "store", { | ||
@@ -28,0 +34,0 @@ enumerable: true, |
@@ -40,7 +40,7 @@ "use strict"; | ||
if (!_vdom.hydratedIslands.has(node)) { | ||
await (0, _utils.yieldToMain)(); | ||
await (0, _utils.splitTask)(); | ||
const fragment = getRegionRootFragment(node); | ||
const vdom = (0, _vdom.toVdom)(node); | ||
initialVdom.set(node, vdom); | ||
await (0, _utils.yieldToMain)(); | ||
await (0, _utils.splitTask)(); | ||
(0, _preact.hydrate)(vdom, fragment); | ||
@@ -47,0 +47,0 @@ } |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.kebabToCamelCase = kebabToCamelCase; | ||
exports.splitTask = void 0; | ||
exports.useCallback = useCallback; | ||
@@ -18,3 +19,2 @@ exports.useEffect = useEffect; | ||
exports.withScope = withScope; | ||
exports.yieldToMain = void 0; | ||
var _hooks = require("preact/hooks"); | ||
@@ -57,3 +57,3 @@ var _signals = require("@preact/signals"); | ||
*/ | ||
const yieldToMain = () => { | ||
const splitTask = () => { | ||
return new Promise(resolve => { | ||
@@ -77,3 +77,3 @@ // TODO: Use scheduler.yield() when available. | ||
*/ | ||
exports.yieldToMain = yieldToMain; | ||
exports.splitTask = splitTask; | ||
function createFlusher(compute, notify) { | ||
@@ -80,0 +80,0 @@ let flush = () => undefined; |
{ | ||
"name": "@wordpress/interactivity", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Package that provides a standard and simple way to handle the frontend interactivity of Gutenberg blocks.", | ||
@@ -37,3 +37,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "0e973525f7787401b5a544e0727774d52a78639f" | ||
"gitHead": "9dd5f8dcfa4fc7242e5d48be20ee789ad087b432" | ||
} |
@@ -28,2 +28,3 @@ /** | ||
useMemo, | ||
splitTask, | ||
} from './utils'; | ||
@@ -30,0 +31,0 @@ |
@@ -9,3 +9,3 @@ /** | ||
import { toVdom, hydratedIslands } from './vdom'; | ||
import { createRootFragment, yieldToMain } from './utils'; | ||
import { createRootFragment, splitTask } from './utils'; | ||
import { directivePrefix } from './constants'; | ||
@@ -39,7 +39,7 @@ | ||
if ( ! hydratedIslands.has( node ) ) { | ||
await yieldToMain(); | ||
await splitTask(); | ||
const fragment = getRegionRootFragment( node ); | ||
const vdom = toVdom( node ); | ||
initialVdom.set( node, vdom ); | ||
await yieldToMain(); | ||
await splitTask(); | ||
hydrate( vdom, fragment ); | ||
@@ -46,0 +46,0 @@ } |
@@ -57,3 +57,3 @@ /** | ||
*/ | ||
export const yieldToMain = () => { | ||
export const splitTask = () => { | ||
return new Promise( ( resolve ) => { | ||
@@ -60,0 +60,0 @@ // TODO: Use scheduler.yield() when available. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
485584
5889