Skip to content

Commit

Permalink
Deno implement One Button Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rajsite committed Jul 21, 2024
1 parent 75f39c6 commit c4bdb0e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Deno/Packages/TypeScript/Runtime/runtime-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,28 @@ async function createInstance () {
throw new Error('Unsupported on this target');
};

const logLabVIEWError = function (_ignoreReturnValueRef: unknown, _statusValueRef: unknown, codeValueRef: unknown, sourceValueRef: unknown) {
const LogLabVIEWError = function (_ignoreReturnValueRef: unknown, _statusValueRef: unknown, codeValueRef: unknown, sourceValueRef: unknown) {
const code = vireo.eggShell.readDouble(codeValueRef);
const source = vireo.eggShell.readString(sourceValueRef);
throw new Error(`LabVIEW error ${code} occured at ${source === '' ? 'unknown location' : source}`);
};

const OneButtonDialog = function (returnValueRef: unknown, messageTextValueRef: unknown, textOneValueRef: unknown) {
const messageText = vireo.eggShell.readString(messageTextValueRef);
const textOne = vireo.eggShell.readString(textOneValueRef);
alert(messageText + (textOne !== '' ? ` (${textOne})` : ''));

// Ignores the return value of the dialog, LabVIEW always returns true despite what was returned.
vireo.eggShell.writeDouble(returnValueRef, 1);
};

vireo.javaScriptInvoke.registerInternalFunctions({
ControlReference_GetControlObject: notSupportedError,
PropertyNode_PropertyRead: notSupportedError,
PropertyNode_PropertyWrite: notSupportedError,
OneButtonDialog: notSupportedError,
OneButtonDialog,
TwoButtonDialog: notSupportedError,
LogLabVIEWError: logLabVIEWError,
LogLabVIEWError,
InvokeControlFunction: notSupportedError
});
return vireo;
Expand Down

0 comments on commit c4bdb0e

Please sign in to comment.