How to use the @wordpress/hooks.actions function in @wordpress/hooks

To help you get started, we’ve selected a few @wordpress/hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / wordpress__hooks / wordpress__hooks-tests.ts View on Github external
// $ExpectType boolean
hooks.doingAction();
// $ExpectType boolean
hooks.doingAction('my-action');
// $ExpectType boolean
hooks.doingFilter();
// $ExpectType boolean
hooks.doingFilter('my-action');

// $ExpectType number
hooks.didAction('my-action');
// $ExpectType number
hooks.didFilter('my-filter');

// $ExpectType HookMap
hooks.actions;
// $ExpectType HookMap
hooks.filters;

(() => {
    const {
        // $ExpectType HookMap
        actions,
        // $ExpectType HookMap
        filters,
    } = hooks.createHooks();

    // $ExpectType ActionCallback[]
    actions.__current;

    // $ExpectType FilterCallback[]
    filters.__current;