Commit 6f4ea800 authored by Jake Read's avatar Jake Read

add init possibility for modules' default vals

parent 45dc48cf
......@@ -164,6 +164,7 @@ To assemble a representation of these, we want to have a kind of 'netlist' that,
## Desires
- heirarchy zoom
- architectural clarity betwixt UI and Heap
- some auto load / save currently.json file so that we can restart program w/o pain ... maybe just save on new user inputs ?
- states / uis / etc - one off / one-at-a-time for updates
- i.e. all f'n update calls are to single module-global state update
- !
......
......@@ -26,6 +26,10 @@ function ATKSerialLink() {
state.connect = Button('click to find and connect', findSerialPort)
state.portStatus = 'closed' // or we hope it will be
atkSerialLink.init = function(){
findSerialPort()
}
/*
------------------------------------------------------
HOOKING UP
......
......@@ -54,6 +54,13 @@ function Planner() {
moveComplete: Output('number')
}
// we'll use one of these to assert / do things
// after the module is loaded, and state is copied etc
// i.e. one thing we can do is assert a starting value
planner.init = function(){
state.isRunning = 0
}
/*
------------------------------------------------------
UPDATING / SETUP
......
......@@ -271,6 +271,11 @@ function openProgram(path) {
}
}
// and let's run init if it's there
if(mdl.init != null){
mdl.init()
}
//console.log('mdlRep', mdlRep)
//console.log('mdl', mdl)
// restore position / UI state
......
......@@ -230,6 +230,10 @@ function uiRequestNewModule(data) {
// just burn it down
socketSend('restart', '')
}
// TODO: questionable init - here and in loadProgram, should be better handled across board
if(program.modules[latest].init != null){
program.modules[latest].init()
}
socketSend('put module', Reps.makeFromModule(program.modules[keys[keys.length - 1]]))
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment