Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hooks.addFilter('my-filter', 'my/namespace', (foo: string, bar: number) => `${foo}${bar}`);
hooks.addFilter('my-filter', 'my/namespace', (foo: number, bar: number) => bar, 23);
hooks.removeAction('my-action', 'my/namespace');
hooks.removeFilter('my-filter', 'my/namespace');
// $ExpectType boolean
hooks.hasAction('my-action');
// $ExpectType boolean
hooks.hasFilter('my-filter');
hooks.removeAllActions('my-action', 'my/namespace');
hooks.removeAllFilters('my-filter', 'my/namespace');
// $ExpectType unknown
hooks.doAction('my-action');
// $ExpectType string
hooks.doAction('my-action', 'foo');
// $ExpectType unknown
hooks.applyFilters('my-filter');
// $ExpectType number
hooks.applyFilters('my-action', 123);
// $ExpectType (string | number)[]
hooks.applyFilters('my-action', [123, '456']);
// $ExpectType string | null
hooks.currentAction();
// $ExpectType string | null
hooks.currentFilter();
// $ExpectType boolean
domReady( function() {
const wpDashboard = document.getElementById( 'js-googlesitekit-wp-dashboard' );
if ( null !== wpDashboard ) {
// Render the Dashboard App.
render( , wpDashboard );
/**
* Action triggered when the WP Dashboard App is loaded.
*/
doAction( 'googlesitekit.moduleLoaded', 'WPDashboard' );
}
} );
domReady( function() {
const dashboardDetails = document.getElementById( 'js-googlesitekit-dashboard-details' );
if ( null !== dashboardDetails ) {
// Render the Dashboard App.
render( , dashboardDetails );
/**
* Action triggered when the dashboard details App is loaded.
*/
doAction( 'googlesitekit.moduleLoaded', 'Dashboard' );
}
} );
domReady( function() {
if ( googlesitekit.admin.resetSession ) {
clearAppLocalStorage();
}
const dashboardSplash = document.getElementById( 'js-googlesitekit-dashboard-splash' );
if ( null !== dashboardSplash ) {
// Render the Dashboard Splash App.
render( , dashboardSplash );
/**
* Action triggered when the Dashboard Splash App is loaded.
*/
doAction( 'googlesitekit.moduleLoaded', 'Splash' );
}
} );
function triggerNextService() {
doAction( 'updated_node_and_npm' );
}
settings = applyFilters( 'plugins.registerPlugin', settings, name );
if ( ! isFunction( settings.render ) ) {
console.error(
'The "render" property must be specified and must be a valid function.'
);
return null;
}
plugins[ name ] = {
name,
icon: 'admin-plugins',
...settings,
};
doAction( 'plugins.pluginRegistered', settings, name );
return settings;
}
onChangeScreen( value ) {
const firstScreenOption = this.props.screens[ 0 ]
if ( ! this.state.isScreenPickerOpen && this.state.screen === firstScreenOption && value === firstScreenOption ) {
this.setState( { isScreenPickerOpen: true } )
if ( typeof instanceIdOwner === 'undefined' ) {
setIsScreenPickerOpen( true )
doAction( 'stackable.responsive-toggle.screen.open' )
}
} else if ( this.state.isScreenPickerOpen && value === firstScreenOption ) {
this.setState( { isScreenPickerOpen: false } )
if ( typeof instanceIdOwner === 'undefined' ) {
setIsScreenPickerOpen( false )
doAction( 'stackable.responsive-toggle.screen.close' )
}
}
this.props.onChangeScreen( value )
this.setState( { screen: value } )
setSelectedScreen( value )
doAction( 'stackable.responsive-toggle.screen.change', value )
}
enableMarginBottom: true,
enableMarginLeft: true,
enablePaddingTop: true,
enablePaddingRight: true,
enablePaddingBottom: true,
enablePaddingLeft: true,
...options,
}
addFilter( `stackable.${ blockName }.edit.inspector.advanced.before`, `stackable/${ blockName }/advanced-block-spacing`, inspectorControls( blockName, optionsToPass ), 5 )
if ( optionsToPass.modifyStyles ) {
addFilter( `stackable.${ blockName }.styles`, `stackable/${ blockName }/advanced-block-spacing`, addToStyleObject( blockName, optionsToPass ) )
}
addFilter( `stackable.${ blockName }.attributes`, `stackable/${ blockName }/advanced-block-spacing`, addAttributes )
addFilter( `stackable.${ blockName }.main-block.classes`, `stackable/${ blockName }/advanced-block-spacing`, addCustomWidthClassName )
doAction( `stackable.module.advanced-block-spacing`, blockName )
}
const contentAlign = blockName => {
addFilter( `stackable.${ blockName }.edit.inspector.before`, `stackable/${ blockName }/content-align`, addAlignToolbar, 11 )
addFilter( `stackable.${ blockName }.attributes`, `stackable/${ blockName }/content-align`, addAttributes )
addFilter( `stackable.${ blockName }.styles`, `stackable/${ blockName }/content-align`, addStyles, 9 )
doAction( `stackable.module.content-align`, blockName )
}
setTimeout( () => {
doAction(
'googlesitekit.moduleLoaded',
'Dashboard'
);
}, 250 );
return (