Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* WordPress dependencies
*/
import { registerStore } from '@wordpress/data';
/**
* Internal dependencies
*/
import reducer from './reducer';
import * as actions from './actions';
import * as selectors from './selectors';
export default registerStore( 'core/viewport', {
reducer,
actions,
selectors,
} );
export function register(): typeof STORE_KEY {
if ( ! isRegistered ) {
isRegistered = true;
registerStore< State >( STORE_KEY, {
actions,
controls,
reducer,
resolvers,
selectors,
} );
}
return STORE_KEY;
}
import { registerStore } from '@wordpress/data';
import reducer from './reducer';
import * as actions from './actions';
import * as selectors from './selectors';
import applyMiddlewares from './middlewares';
const { controls: dataControls } = LP.dataControls;
const store = registerStore( 'learnpress/modal', {
reducer,
selectors,
actions,
controls: {
...dataControls,
},
} );
applyMiddlewares( store );
export default store;
/**
* Internal dependencies
*/
import reducer from './reducer';
import applyMiddlewares from './middlewares';
import * as selectors from './selectors';
import * as actions from './actions';
import * as tokens from '../components/rich-text/core-tokens';
import { validateTokenSettings } from '../components/rich-text/tokens';
/**
* Module Constants
*/
const MODULE_KEY = 'core/editor';
const store = registerStore( MODULE_KEY, {
reducer: restrictPersistence( reducer, 'preferences' ),
selectors,
actions,
persist: true,
} );
applyMiddlewares( store );
forOwn( tokens, ( { name, settings } ) => {
settings = validateTokenSettings( name, settings, store.getState() );
if ( settings ) {
store.dispatch( actions.registerToken( name, settings ) );
}
} );
export default store;
*/
import { registerStore } from '@wordpress/data';
/**
* Internal dependencies
*/
import reducer from './reducer';
import * as selectors from './selectors';
import * as actions from './actions';
/**
* Module Constants
*/
const MODULE_KEY = 'core/annotations';
const store = registerStore( MODULE_KEY, {
reducer,
selectors,
actions,
} );
export default store;
/**
* External dependencies.
*/
import { registerStore } from '@wordpress/data';
/**
* Internal dependencies.
*/
import reducer from './reducer';
import * as actions from './actions';
import * as selectors from './selectors';
/**
* Register the store.
*/
registerStore( 'carbon-fields/blocks', {
reducer,
actions,
selectors
} );
/**
* Block editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore
*
* @type {Object}
*/
export const storeConfig = {
reducer,
selectors,
actions,
controls,
resolvers,
};
const store = registerStore( MODULE_KEY, storeConfig );
export default store;
/**
* Block editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore
*
* @type {Object}
*/
export const storeConfig = {
reducer,
selectors,
actions,
controls,
resolvers,
};
const store = registerStore( MODULE_KEY, storeConfig );
export default store;
enablePlugin( plugin ) {
return {
type: 'ENABLE_PLUGIN',
plugin,
};
},
fetchFromAPI( path ) {
return {
type: 'FETCH_FROM_API',
path,
};
},
};
registerStore(
'site-health-plugins', {
reducer( state = SiteHealth_TroubleshootingMode_DefaultState_Plugins, action ) {
switch ( action.type ) {
case 'SET_PLUGINS':
return {
...state,
plugins: action.plugins
};
case 'ENABLE_PLUGIN':
return {
...state,
plugins: {
...state.plugins,
[ action.plugin.slug ]: action.plugin,
},
};
const registerExportStore = () =>
registerStore( EXPORT_STORE, {
reducer: createReducerFromActionMap( reducers, EMPTY_STATE ),
actions,
selectors,
resolvers,
controls: { ...dataControls, ...scheduleControls },
} );