Skip to content

Commit

Permalink
Merge pull request google#1078 from google/feat/997-googlesitekit-dat…
Browse files Browse the repository at this point in the history
…a-scaffold

Scaffold data script.
  • Loading branch information
felixarntz authored Jan 28, 2020
2 parents 833499e + a2a9419 commit f8135b7
Show file tree
Hide file tree
Showing 6 changed files with 322 additions and 85 deletions.
10 changes: 10 additions & 0 deletions assets/js/googlesitekit-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* External dependencies
*/
import Data from 'assets/js/googlesitekit/data';

if ( typeof global.googlesitekit === 'undefined' ) {
global.googlesitekit = {};
}

global.googlesitekit.data = Data;
8 changes: 8 additions & 0 deletions assets/js/googlesitekit/data/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* WordPress dependencies
*/
import { createRegistry } from '@wordpress/data';

const DataStoreRegistry = createRegistry();

export default DataStoreRegistry;
7 changes: 7 additions & 0 deletions includes/Core/Assets/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ private function get_assets() {
'dependencies' => $dependencies,
)
),
new Script(
'googlesitekit-data',
array(
'src' => $base_url . 'js/googlesitekit-data.js',
'dependencies' => $dependencies,
)
),
// End JSR Assets.
new Script(
'googlesitekit_ads_detect',
Expand Down
Loading

0 comments on commit f8135b7

Please sign in to comment.