5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-06 11:20:51 +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", "name": "@wailsio/runtime",
"version": "3.0.0-alpha.8", "version": "3.0.0-alpha.9",
"description": "Wails Runtime", "description": "Wails Runtime",
"main": "src/index.js", "main": "src/index.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",

View File

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

View File

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

View File

@ -7,7 +7,7 @@
* *
* @return {undefined} * @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. * 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 {Plugin, Call, errorHandler as callErrorHandler, resultHandler as callResultHandler, ByID, ByName} from "./@wailsio/runtime/calls";
import {clientId} from './@wailsio/runtime/runtime'; import {clientId} from './@wailsio/runtime/runtime';
import {dispatchWailsEvent, Emit, Off, OffAll, On, Once, OnMultiple} from "./@wailsio/runtime/events"; 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 {setupContextMenus} from './@wailsio/runtime/contextmenu';
import {reloadWML} from './@wailsio/runtime/wml'; import {reloadWML} from './@wailsio/runtime/wml';
import {setupDrag, endDrag, setResizable} from './@wailsio/runtime/drag'; import {setupDrag, endDrag, setResizable} from './@wailsio/runtime/drag';
@ -31,7 +31,7 @@ window.wails = {
// Internal wails endpoints // Internal wails endpoints
window._wails = { window._wails = {
dialogCallback, dialogResultCallback,
dialogErrorCallback, dialogErrorCallback,
dispatchWailsEvent, dispatchWailsEvent,
callErrorHandler, 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) { func (w *WebviewWindow) DialogResponse(dialogID string, result string, isJSON bool) {
if w.impl != nil { if w.impl != nil {
if isJSON { 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 { } 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) { func (w Window) DialogResponse(dialogID string, result string, isJSON bool) {
cmd := "_wails.dialogCallback('%s', %s, true);" cmd := "_wails.dialogResultCallback('%s', %s, true);"
if !isJSON { if !isJSON {
cmd = "_wails.dialogCallback('%s', %s, false);" cmd = "_wails.dialogResultCallback('%s', %s, false);"
} }
w.ExecJS(dialogID, w.formatJS(cmd, dialogID, result)) w.ExecJS(dialogID, w.formatJS(cmd, dialogID, result))
} }