@wordpress/core-data 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createRegistryControl } from '@wordpress/data';
5
- export function regularFetch(url) {
6
- return {
7
- type: 'REGULAR_FETCH',
8
- url
9
- };
10
- }
11
- export function getDispatch() {
12
- return {
13
- type: 'GET_DISPATCH'
14
- };
15
- }
16
- const controls = {
17
- async REGULAR_FETCH({
18
- url
19
- }) {
20
- const {
21
- data
22
- } = await window.fetch(url).then(res => res.json());
23
- return data;
24
- },
25
-
26
- GET_DISPATCH: createRegistryControl(({
27
- dispatch
28
- }) => () => dispatch)
29
- };
30
- export default controls;
31
- //# sourceMappingURL=controls.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/controls.js"],"names":["createRegistryControl","regularFetch","url","type","getDispatch","controls","REGULAR_FETCH","data","window","fetch","then","res","json","GET_DISPATCH","dispatch"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,qBAAT,QAAsC,iBAAtC;AAEA,OAAO,SAASC,YAAT,CAAuBC,GAAvB,EAA6B;AACnC,SAAO;AACNC,IAAAA,IAAI,EAAE,eADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED,OAAO,SAASE,WAAT,GAAuB;AAC7B,SAAO;AACND,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED,MAAME,QAAQ,GAAG;AAChB,QAAMC,aAAN,CAAqB;AAAEJ,IAAAA;AAAF,GAArB,EAA+B;AAC9B,UAAM;AAAEK,MAAAA;AAAF,QAAW,MAAMC,MAAM,CAC3BC,KADqB,CACdP,GADc,EAErBQ,IAFqB,CAEbC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAFI,CAAvB;AAIA,WAAOL,IAAP;AACA,GAPe;;AAShBM,EAAAA,YAAY,EAAEb,qBAAqB,CAAE,CAAE;AAAEc,IAAAA;AAAF,GAAF,KAAoB,MAAMA,QAA5B;AATnB,CAAjB;AAYA,eAAeT,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistryControl } from '@wordpress/data';\n\nexport function regularFetch( url ) {\n\treturn {\n\t\ttype: 'REGULAR_FETCH',\n\t\turl,\n\t};\n}\n\nexport function getDispatch() {\n\treturn {\n\t\ttype: 'GET_DISPATCH',\n\t};\n}\n\nconst controls = {\n\tasync REGULAR_FETCH( { url } ) {\n\t\tconst { data } = await window\n\t\t\t.fetch( url )\n\t\t\t.then( ( res ) => res.json() );\n\n\t\treturn data;\n\t},\n\n\tGET_DISPATCH: createRegistryControl( ( { dispatch } ) => () => dispatch ),\n};\n\nexport default controls;\n"]}
package/src/controls.js DELETED
@@ -1,31 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createRegistryControl } from '@wordpress/data';
5
-
6
- export function regularFetch( url ) {
7
- return {
8
- type: 'REGULAR_FETCH',
9
- url,
10
- };
11
- }
12
-
13
- export function getDispatch() {
14
- return {
15
- type: 'GET_DISPATCH',
16
- };
17
- }
18
-
19
- const controls = {
20
- async REGULAR_FETCH( { url } ) {
21
- const { data } = await window
22
- .fetch( url )
23
- .then( ( res ) => res.json() );
24
-
25
- return data;
26
- },
27
-
28
- GET_DISPATCH: createRegistryControl( ( { dispatch } ) => () => dispatch ),
29
- };
30
-
31
- export default controls;