Skip to content
Snippets Groups Projects
Commit 6f4ea800 authored by Jake Read's avatar Jake Read
Browse files

add init possibility for modules' default vals

parent 45dc48cf
No related branches found
No related tags found
No related merge requests found
...@@ -164,6 +164,7 @@ To assemble a representation of these, we want to have a kind of 'netlist' that, ...@@ -164,6 +164,7 @@ To assemble a representation of these, we want to have a kind of 'netlist' that,
## Desires ## Desires
- heirarchy zoom - heirarchy zoom
- architectural clarity betwixt UI and Heap - 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 - 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 - i.e. all f'n update calls are to single module-global state update
- ! - !
......
...@@ -26,6 +26,10 @@ function ATKSerialLink() { ...@@ -26,6 +26,10 @@ function ATKSerialLink() {
state.connect = Button('click to find and connect', findSerialPort) state.connect = Button('click to find and connect', findSerialPort)
state.portStatus = 'closed' // or we hope it will be state.portStatus = 'closed' // or we hope it will be
atkSerialLink.init = function(){
findSerialPort()
}
/* /*
------------------------------------------------------ ------------------------------------------------------
HOOKING UP HOOKING UP
......
...@@ -54,6 +54,13 @@ function Planner() { ...@@ -54,6 +54,13 @@ function Planner() {
moveComplete: Output('number') 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 UPDATING / SETUP
......
...@@ -271,6 +271,11 @@ function openProgram(path) { ...@@ -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('mdlRep', mdlRep)
//console.log('mdl', mdl) //console.log('mdl', mdl)
// restore position / UI state // restore position / UI state
......
...@@ -230,6 +230,10 @@ function uiRequestNewModule(data) { ...@@ -230,6 +230,10 @@ function uiRequestNewModule(data) {
// just burn it down // just burn it down
socketSend('restart', '') 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]])) socketSend('put module', Reps.makeFromModule(program.modules[keys[keys.length - 1]]))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment