override hid deploy if can hid (#678)
This commit is contained in:
parent
81e8f5eeec
commit
08fb679adf
@ -116,18 +116,21 @@ namespace pxt.editor {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function initAsync() {
|
function canHID(): boolean {
|
||||||
let canHID = false
|
let r = false
|
||||||
if (U.isNodeJS) {
|
if (U.isNodeJS) {
|
||||||
canHID = true
|
r = true
|
||||||
} else {
|
} else {
|
||||||
const forceHexDownload = /forceHexDownload/i.test(window.location.href);
|
const forceHexDownload = /forceHexDownload/i.test(window.location.href);
|
||||||
const isUwp = !!(window as any).Windows;
|
const isUwp = !!(window as any).Windows;
|
||||||
if (Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload || isUwp)
|
if (Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload || isUwp)
|
||||||
canHID = true
|
r = true
|
||||||
}
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
if (canHID) {
|
function initAsync() {
|
||||||
|
if (canHID()) {
|
||||||
return dapAsync();
|
return dapAsync();
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error("no HID"))
|
return Promise.reject(new Error("no HID"))
|
||||||
@ -401,7 +404,9 @@ namespace pxt.editor {
|
|||||||
.then(text => project.overrideTypescriptFile(text))
|
.then(text => project.overrideTypescriptFile(text))
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
pxt.commands.deployCoreAsync = deployCoreAsync;
|
|
||||||
|
if (canHID())
|
||||||
|
pxt.commands.deployCoreAsync = deployCoreAsync;
|
||||||
return Promise.resolve<pxt.editor.ExtensionResult>(res);
|
return Promise.resolve<pxt.editor.ExtensionResult>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user