File tree Expand file tree Collapse file tree 3 files changed +40
-14
lines changed
Expand file tree Collapse file tree 3 files changed +40
-14
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import { initStore } from '../src' ;
3+ import { ENQ_ASK } from '../src/store/store' ;
4+
5+ import config from './config' ;
6+
7+ const storeEnv = initStore ( config ) ;
8+ const setupChannel = storeEnv . channelInit ( ENQ_ASK , 'ad02' ) ;
9+ const stopChannel = setupChannel ( ) ;
10+ console . log ( storeEnv ) ;
11+ const store = storeEnv . addonStore . getAll ( ) ;
12+ console . log ( 'store:' , store ) ;
13+ let querry = {
14+ chapter : 'undef' ,
15+ } ;
16+ const stopQuerySubscription = storeEnv . addonStore . watch ( 'queryData' , ( data ) => {
17+ // console.info('queryData in addon:', data)
18+ querry = data ;
19+ } ) ;
220
321const querryManager = {
422 qIndex : 0 ,
@@ -9,11 +27,14 @@ const querryManager = {
927
1028const addons = {
1129 querry ( ) {
12- this . add ( 'querry addon' , ( ) => (
13- < div >
14- It is a test querry addon { `#${ querryManager . getInd ( ) } ` }
15- </ div >
16- ) )
30+ console . log ( 'store querry:' , storeEnv . addonStore . getAll ( ) ) ;
31+ this . add ( 'querry addon' , ( ) => {
32+ console . log ( 'store select:' , storeEnv . addonStore . getAll ( ) ) ;
33+ // storeEnv.addonStore.set('queryData', {chapter: 'lalala'});
34+ return ( < div >
35+ It is a test querry addon: { `#${ querry . chapter } ` }
36+ </ div > )
37+ } )
1738 }
1839}
1940
Original file line number Diff line number Diff line change 11const ADDON_ID = 'querry' ;
2- export default {
2+ const config = {
33 ADDON_ID ,
44 ADDON_TITLE : 'Q' ,
55 PANEL_ID : `${ ADDON_ID } /no_panels_here` ,
66 EVENT_ID_INIT : `${ ADDON_ID } /q/init` ,
77 EVENT_ID_DATA : `${ ADDON_ID } /q/data` ,
88 CSS_CLASS : 'addon-querry' ,
99} ;
10+ export default {
11+ initData : 'QQQ - this is init data' ,
12+ config,
13+ queryParams : {
14+ chapter : 'no' ,
15+ } ,
16+ } ;
Original file line number Diff line number Diff line change 11import { register } from '../src' ;
2+ import { ENQ_SEND } from '../src/store/store' ;
23//import addonApi from './api';
34import config from './config' ;
45//import defaultData from './defaultData';
56//import panelRoutes from './panelRoutes';
67
7- const panelSettings = {
8- initData : 'QQQ - this is init data' ,
9- config,
10- queryParams : {
11- chapters : 'no' ,
12- } ,
13- } ;
148
15- register ( panelSettings ) ;
9+ register ( config , ( env ) => {
10+ console . log ( env ) ;
11+ const setupChannel = env . channelInit ( ENQ_SEND , 'qq01' ) ;
12+ const stopChannel = setupChannel ( ) ;
13+ } ) ;
You can’t perform that action at this time.
0 commit comments