statebus 7.0.0 → 7.0.1

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.
package/clients.js CHANGED
@@ -224,13 +224,6 @@
224
224
  function localstorage_client (prefix) {
225
225
  try { localStorage } catch (e) { return }
226
226
 
227
- // This doesn't yet trigger updates across multiple browser windows.
228
- // We can do that by adding a list of dirty keys and
229
-
230
- var bus = this
231
- bus.log(this)
232
-
233
- // Get returns the value immediately in a set
234
227
  // Sets are queued up, to store values with a delay, in batch
235
228
  var sets_are_pending = false
236
229
  var pending_sets = {}
@@ -522,7 +515,7 @@
522
515
  var react_render
523
516
  function scripts_ready () {
524
517
  react_render = ReactDOM.render
525
- make_client_statebus_maker()
518
+ // make_client_statebus_maker()
526
519
  window.bus = window.statebus()
527
520
  bus.label = 'bus'
528
521
 
@@ -535,6 +528,8 @@
535
528
  bus.libs.http_out = http_mount
536
529
  bus.libs.react_class = create_react_class
537
530
  bus.libs.input = make_better_input_17()
531
+ bus.libs.localstorage = localstorage_client
532
+
538
533
  // if (statebus_server !== 'none') {
539
534
  // if (clientjs_option('braid_mode')) {
540
535
  // console.log('Using Braid-HTTP!')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "statebus",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Synchronize state.",
5
5
  "main": "statebus.js",
6
6
  "scripts": {
package/servers.js CHANGED
@@ -103,7 +103,7 @@ function import_server (bus, options)
103
103
  bus.express.use(bus.http)
104
104
 
105
105
  // Connect bus to the HTTP server
106
- bus.express.use(bus.handle_http)
106
+ bus.express.use(bus.http_in)
107
107
 
108
108
  // Serve Client Coffee
109
109
  bus.serve_client_coffee()
@@ -154,7 +154,7 @@ function import_server (bus, options)
154
154
  },
155
155
 
156
156
  // Connect HTTP GET and PUT to our Get and Set
157
- handle_http: function (req, res, next) {
157
+ http_in: function (req, res, next) {
158
158
  if (bus.honk)
159
159
  console.log(req.method, req.url, req.headers.subscribe
160
160
  ? 'Subscribe: ' + req.headers.subscribe : '')
@@ -594,7 +594,7 @@ function import_server (bus, options)
594
594
  function save_db() {
595
595
  if (!db_is_ok) return
596
596
 
597
- console.time('saved db')
597
+ // console.time('saved db')
598
598
 
599
599
  fs.writeFile(filename+'.tmp', JSON.stringify(db, null, 1), function(err) {
600
600
  if (err) {
@@ -606,7 +606,7 @@ function import_server (bus, options)
606
606
  console.error('Crap !! DB IS DYING !!!!', err)
607
607
  db_is_ok = false
608
608
  } else {
609
- console.timeEnd('saved db')
609
+ // console.timeEnd('saved db')
610
610
  pending_save = null
611
611
  }
612
612
  })
@@ -1131,7 +1131,7 @@ function import_server (bus, options)
1131
1131
  JSON.stringify(details)])
1132
1132
  },
1133
1133
 
1134
- serve_time () {
1134
+ time () {
1135
1135
  if (bus('time*').to_get.length > 0)
1136
1136
  // Then it's already installed
1137
1137
  return
@@ -2417,11 +2417,10 @@ function import_server (bus, options)
2417
2417
  }
2418
2418
  }
2419
2419
  // Add methods to bus object
2420
- for (var m in extra_methods)
2420
+ for (var m in extra_methods) {
2421
2421
  bus[m] = extra_methods[m]
2422
-
2423
- bus.libs.time = extra_methods.serve_time
2424
- bus.libs.http_in = extra_methods.handle_http
2422
+ bus.libs[m] = extra_methods[m]
2423
+ }
2425
2424
 
2426
2425
  bus.options = default_options(bus)
2427
2426
  set_options(bus, options)
package/statebus.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
5
5
  else this[name] = definition()
6
6
  }('statebus', function() {statelog_indent = 0; var busses = {}, bus_count = 0, executing_funk, global_funk, funks = {}, clean_timer, symbols, nodejs = typeof window === 'undefined'; function make_bus (options) {
7
-
7
+
8
8
 
9
9
  // ****************
10
10
  // Get, Set, Forget, Delete