5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 01:31:54 +08:00

@wailsio/runtime alpha.9 - Fix call responses.

This commit is contained in:
Lea Anthony 2023-12-30 15:49:23 +11:00
parent 4151deb9f6
commit 5b51e0fad3
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
7 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@wailsio/runtime",
"version": "3.0.0-alpha.8",
"version": "3.0.0-alpha.9",
"description": "Wails Runtime",
"main": "src/index.js",
"types": "types/index.d.ts",

View File

@ -17,8 +17,8 @@ const call = newRuntimeCallerWithID(objectNames.Call, '');
let callResponses = new Map();
window._wails = window._wails || {};
window._wails.callCallback = resultHandler;
window._wails.callErrorCallback = errorHandler;
window._wails.callResultHandler = resultHandler;
window._wails.callErrorHandler = errorHandler;
function generateID() {
let result;

View File

@ -70,7 +70,7 @@ function dialog(type, options = {}) {
*
* @return {undefined}
*/
export function dialogCallback(id, data, isJSON) {
export function dialogResultCallback(id, data, isJSON) {
let p = dialogResponses.get(id);
if (p) {
if (isJSON) {

View File

@ -7,7 +7,7 @@
*
* @return {undefined}
*/
export function dialogCallback(id: string, data: string, isJSON: boolean): undefined;
export function dialogResultCallback(id: string, data: string, isJSON: boolean): undefined;
/**
* Callback function for handling errors in dialog.
*

View File

@ -19,7 +19,7 @@ import * as Window from './@wailsio/runtime/window';
import {Plugin, Call, errorHandler as callErrorHandler, resultHandler as callResultHandler, ByID, ByName} from "./@wailsio/runtime/calls";
import {clientId} from './@wailsio/runtime/runtime';
import {dispatchWailsEvent, Emit, Off, OffAll, On, Once, OnMultiple} from "./@wailsio/runtime/events";
import {dialogCallback, dialogErrorCallback, Error, Info, OpenFile, Question, SaveFile, Warning} from "./@wailsio/runtime/dialogs";
import {dialogResultCallback, dialogErrorCallback, Error, Info, OpenFile, Question, SaveFile, Warning} from "./@wailsio/runtime/dialogs";
import {setupContextMenus} from './@wailsio/runtime/contextmenu';
import {reloadWML} from './@wailsio/runtime/wml';
import {setupDrag, endDrag, setResizable} from './@wailsio/runtime/drag';
@ -31,7 +31,7 @@ window.wails = {
// Internal wails endpoints
window._wails = {
dialogCallback,
dialogResultCallback,
dialogErrorCallback,
dispatchWailsEvent,
callErrorHandler,

View File

@ -258,9 +258,9 @@ func (w *WebviewWindow) DialogError(dialogID string, result string) {
func (w *WebviewWindow) DialogResponse(dialogID string, result string, isJSON bool) {
if w.impl != nil {
if isJSON {
w.impl.execJS(w.formatJS("_wails.dialogCallback('%s', %s, true);", dialogID, result))
w.impl.execJS(w.formatJS("_wails.dialogResultCallback('%s', %s, true);", dialogID, result))
} else {
w.impl.execJS(fmt.Sprintf("_wails.dialogCallback('%s', '%s', false);", dialogID, result))
w.impl.execJS(fmt.Sprintf("_wails.dialogResultCallback('%s', '%s', false);", dialogID, result))
}
}
}

View File

@ -50,9 +50,9 @@ func (w Window) DialogError(dialogID string, result string) {
}
func (w Window) DialogResponse(dialogID string, result string, isJSON bool) {
cmd := "_wails.dialogCallback('%s', %s, true);"
cmd := "_wails.dialogResultCallback('%s', %s, true);"
if !isJSON {
cmd = "_wails.dialogCallback('%s', %s, false);"
cmd = "_wails.dialogResultCallback('%s', %s, false);"
}
w.ExecJS(dialogID, w.formatJS(cmd, dialogID, result))
}