1. Add to configDependencies
{
"name": "place-my-order",
"system": {
"configDependencies": [
"live-reload"
]
}
}
2. Start web socket server
# steal-tools live-reload
import reload from "live-reload";
reload(render);
function render(){
$("body").append(template(new AppState()));
}
Called at the end of a reload cycle.
Called after moduleName is reloaded.
import reload from "live-reload";
// Re-initialize the router.
reload("app/router", function(router){
window.router = router;
router.start();
});
Called after any module is reloaded.
Includes the moduleName as the first argument.
Called when the module is being destroyed.
import reload from "live-reload";
window.sideEffect = "i am a side effect";
reload.dispose(function(){
delete window.sideEffect;
});
Make your css plugin incorporate live-reload
With the name of the module that changed.
{
"restaurant/list/list.stache": {
"restaurant/list/list": true
},
"header.component": {
"index.stache": true
},
"models/order": {
"index.stache": true
},
"index.stache": false
}
Calling dispose callbacks as you go
Call any callbacks for these modules
{
"restaurant/list/list.stache": {
load: { source: "..." },
dependencies: ["can/view/href/href"]
},
"restaurant/list/list": {
load: { source: "..." },
dependencies: ["restaurant/list/list.stache"]
}
}
System.translate(source).then(function(source){
load.source = source;
return System.instantiate(load);
}).then(function(result){
if(!same(oldDependencies, result.dependencies)) {
// We have to load this graph
}
});
// before
[
"can",
"restaurant/list/list.stache"
]
// after
[
"can",
"retaurant/list/list.stache",
"models/order"
]