Closed karth295 closed 6 years ago
Good catch! The state
variable should indeed only be global on the client. I see a bug with how it's being initialized, and am fixing it now.
On the server, we make a few globals: loading
, clone
, and forget
. I'm not sure if these should be.
On the client, we also make global fetch
, save
, del
, and state
. On the server, you have to disambiguate which bus you're referring to, so you'll always have to specify the master
in master.fetch()
, and there's no advantage to making them global.
On the client it's not surprising that a JS library creates global variables, but on a nodejs server I expect to use
require
. I'm specifically thinking of thestate
variable -- it should either be used asbus.state
on servers or do something likeconst {bus, state} = require('statebus')
.