Fix hid deployment from command line

This commit is contained in:
Michal Moskal 2017-08-08 11:47:10 +02:00
parent d42117a2a5
commit ebcde71950

View File

@ -28,9 +28,22 @@ namespace pxt.editor {
let initPromise: Promise<Ev3Wrapper>
function initAsync() {
if (initPromise)
return initPromise
let canHID = false
if (U.isNodeJS) {
canHID = true
} else {
const forceHexDownload = /forceHexDownload/i.test(window.location.href);
if (Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload) {
if (!initPromise)
if (Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload)
canHID = true
}
if (noHID)
canHID = false
if (canHID) {
initPromise = hf2Async()
.catch(err => {
initPromise = null
@ -41,6 +54,7 @@ namespace pxt.editor {
noHID = true
initPromise = Promise.reject(new Error("no HID"))
}
return initPromise
}