Skip to content

Commit ad97e72

Browse files
committed
#netpyne-99 feat: Add guard to avoid sending two time READY message
1 parent 1c829a3 commit ad97e72

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

webapp/components/NetPyNE.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@ class NetPyNE extends React.Component {
5959
const loadFromEvent = event => {
6060
console.log('Parent frame message received:', event)
6161

62-
// Here we would expect some cross-origin check, but we don't do anything more than load a nwb file here
62+
// Here we would expect some cross-origin check, but we don't do anything more than load a model here
6363
switch (event.data.type) {
6464
case 'INIT_INSTANCE':
65-
console.log('NOW WE CAN SWITCH STATE?')
65+
if (this.loaded) {
66+
return
67+
}
6668
this.loaded = true
69+
console.log('Netpyne is ready')
6770
if (window !== window.parent) {
6871
window.parent.postMessage({
6972
type: 'APP_READY'

0 commit comments

Comments
 (0)