File tree Expand file tree Collapse file tree 5 files changed +14
-12
lines changed
overmind-devtools/src/app Expand file tree Collapse file tree 5 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import {
3131} from './operators'
3232
3333export const onInitialize : OnInitialize = async ( {
34- value : actions ,
34+ value : app ,
3535 state,
3636 storage,
3737 connector,
@@ -40,7 +40,7 @@ export const onInitialize: OnInitialize = async ({
4040 if ( port ) {
4141 state . port = port
4242 }
43- connector . onMessage ( actions . onMessage )
43+ connector . onMessage ( app . actions . onMessage )
4444 connector . connect ( state . port )
4545}
4646
Original file line number Diff line number Diff line change 11import * as jsonStorage from 'electron-json-storage'
2- import BackendConnector from 'overmind-devtools/src /BackendConnector'
2+ import BackendConnector from '.. /BackendConnector'
33
44export const connector = new BackendConnector ( )
55
@@ -31,9 +31,9 @@ export const storage = {
3131 // Insanely weird that when "no value", an empty
3232 // object is returned. Should be null
3333 typeof data === 'object' &&
34- ! Array . isArray ( data ) &&
35- data !== null &&
36- Object . keys ( data ) . length === 0
34+ ! Array . isArray ( data ) &&
35+ data !== null &&
36+ Object . keys ( data ) . length === 0
3737 ? null
3838 : data
3939 )
Original file line number Diff line number Diff line change @@ -81,12 +81,13 @@ describe('Overmind', () => {
8181 expect ( app . state . foo ) . toEqual ( 'bar' )
8282 } )
8383
84- test ( 'should instantiate app with onInitialize' , ( ) => {
84+ test ( 'should instantiate app with onInitialize' , async ( ) => {
8585 expect . assertions ( 2 )
86+ let value : any
8687 const app = new Overmind ( {
8788 onInitialize ( context ) {
8889 expect ( context . state . foo ) . toBe ( 'bar' )
89- expect ( typeof context . value . doThis === 'function' ) . toBe ( true )
90+ value = context . value
9091 } ,
9192 state : {
9293 foo : 'bar' ,
@@ -95,8 +96,8 @@ describe('Overmind', () => {
9596 doThis ( ) { } ,
9697 } ,
9798 } )
98-
99- return app . initialized
99+ await app . initialized
100+ expect ( value ) . toBe ( app )
100101 } )
101102 test ( 'should be able to type actions' , ( ) => {
102103 expect . assertions ( 2 )
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
151151 configuration . onInitialize
152152 )
153153
154- this . initialized = Promise . resolve ( onInitialize ( this . actions ) )
154+ this . initialized = Promise . resolve ( onInitialize ( this ) )
155155 } else {
156156 this . initialized = Promise . resolve ( null )
157157 }
Original file line number Diff line number Diff line change 11import { ResolveActions , ResolveState , TBaseContext } from './internalTypes'
2+ import { Overmind } from './'
23
34/** ===== PUBLIC API
45 */
@@ -58,5 +59,5 @@ export type TReaction<Config extends Configuration> = (
5859) => any
5960
6061export type TOnInitialize < Config extends Configuration > = (
61- context : TValueContext < Config , ResolveActions < Config [ 'actions' ] > >
62+ context : TValueContext < Config , Overmind < Config > >
6263) => void
You can’t perform that action at this time.
0 commit comments