fix import promises (#858)
This commit is contained in:
parent
7b4a072fd8
commit
4f3d12d7a5
1 changed files with 20 additions and 5 deletions
|
@ -90,7 +90,8 @@ const Import = {
|
||||||
if (window.confirm('Are you sure you want to create ' + topics.length +
|
if (window.confirm('Are you sure you want to create ' + topics.length +
|
||||||
' new topics and ' + synapses.length + ' new synapses?')) {
|
' new topics and ' + synapses.length + ' new synapses?')) {
|
||||||
self.importTopics(topics)
|
self.importTopics(topics)
|
||||||
window.setTimeout(() => self.importSynapses(synapses), 5000)
|
//window.setTimeout(() => self.importSynapses(synapses), 5000)
|
||||||
|
self.importSynapses(synapses)
|
||||||
} // if
|
} // if
|
||||||
} // if
|
} // if
|
||||||
},
|
},
|
||||||
|
@ -265,10 +266,24 @@ const Import = {
|
||||||
return // next
|
return // next
|
||||||
}
|
}
|
||||||
|
|
||||||
self.createSynapseWithParameters(
|
const topic1Promise = $.Deferred()
|
||||||
synapse.desc, synapse.category, synapse.permission,
|
if (topic1.id) {
|
||||||
topic1, topic2
|
topic1Promise.resolve()
|
||||||
)
|
} else {
|
||||||
|
topic1.on('sync', () => topic1Promise.resolve())
|
||||||
|
}
|
||||||
|
const topic2Promise = $.Deferred()
|
||||||
|
if (topic2.id) {
|
||||||
|
topic2Promise.resolve()
|
||||||
|
} else {
|
||||||
|
topic2.on('sync', () => topic2Promise.resolve())
|
||||||
|
}
|
||||||
|
$.when(topic1Promise, topic2Promise).done(() => {
|
||||||
|
self.createSynapseWithParameters(
|
||||||
|
synapse.desc, synapse.category, synapse.permission,
|
||||||
|
topic1, topic2
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue