tmpvar / livecad

live coding of 3d surfaces and objects
livecad.wtf
53 stars 2 forks source link

don't reload the server in dev mode (unless the server code changes) #40

Closed tmpvar closed 9 years ago

tmpvar commented 9 years ago

We can do better by keeping the majority of the app inside a webworker, and publishing state to the outer context. When a change is detected (probably a POST to some route from the gruntfile) a message is sent up to the browser basically saying "attention! your code is stale"

The webworker immediately notifies the outer context that it should begin fetching the new worker bundle.

Once pending requests have all been resolved, and the state has propagated to the outer context, then the outer context is notified that the worker is ready to be "rebooted"

A new webworker is spawned up and state is pushed into it to, while the machinery to the old webworker is removed.

tmpvar commented 9 years ago

This should be a standalone node module, so we can reuse this in other contexts. It's also possible that someone has already done this.

tmpvar commented 9 years ago

out of scope