-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start of the Web console #185
Conversation
93d8590
to
51c7e0c
Compare
51c7e0c
to
4be5579
Compare
|
||
export default async function getApi() { | ||
if (!api) { | ||
api = await new Api(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit weird in that it doesn't actually need to be async, but we could address that in a follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to leave this as is in case we discover we do need an async phase.
static/app.js
Outdated
|
||
function App() { | ||
let app = makeAppState(); | ||
let properties = ["InfectionStatus"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unused I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's cruft.
let properties = ["InfectionStatus"]; | ||
|
||
return html` | ||
<div><${Time} app=${app} /></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should actually be receiving the generation
value (that's what useEffect
should use to determine it should update) v.s. the update function – only things that trigger an update should get the update function (like the next button)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Fixed.
This is a very primitive Web console. The way it's structured is that there are a series of individual widgets each of which is responsible for displaying some aspect of the simulation. Each widget is individually responsible for retrieving its own information and showing it within its own region. The existing widgets are:
All of these use a shared API object that takes care of communication with the Ixa Web API.
Finally, there is a
next
button which runs the simulation to the next time step. This works by:next()
API call witht
set tot + 1
.Note that this will not stop the next time that simulation time increments but rather the next time the simulation reenters the Web API at a time greater than the previous time. This is because the Web API doesn't respond to requests continuously but only when the simulation is paused. The reason for polling is because the request for the next time might time out (though I actually may need to suppress errors in this case, which I'm not sure I have done).