mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 11:13:40 +03:00
parent
41067cef00
commit
e98393e499
5
.changes/fix-ipc-payload.md
Normal file
5
.changes/fix-ipc-payload.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri": 'patch:bug'
|
||||||
|
---
|
||||||
|
|
||||||
|
No longer unpacking and flattening the `payload` over the IPC so that commands with arguments called `cmd`, `callback`, `error`, `options` or `payload` aren't breaking the IPC.
|
@ -59,11 +59,11 @@
|
|||||||
|
|
||||||
window.__TAURI_INVOKE__ = function invoke(cmd, payload = {}, options) {
|
window.__TAURI_INVOKE__ = function invoke(cmd, payload = {}, options) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var callback = window.__TAURI__.transformCallback(function (r) {
|
const callback = window.__TAURI__.transformCallback(function (r) {
|
||||||
resolve(r)
|
resolve(r)
|
||||||
delete window[`_${error}`]
|
delete window[`_${error}`]
|
||||||
}, true)
|
}, true)
|
||||||
var error = window.__TAURI__.transformCallback(function (e) {
|
const error = window.__TAURI__.transformCallback(function (e) {
|
||||||
reject(e)
|
reject(e)
|
||||||
delete window[`_${callback}`]
|
delete window[`_${callback}`]
|
||||||
}, true)
|
}, true)
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// otherwise use the postMessage interface
|
// otherwise use the postMessage interface
|
||||||
const { data } = processIpcMessage({ cmd, callback, error, options, ...payload })
|
const { data } = processIpcMessage({ cmd, callback, error, options, payload })
|
||||||
window.ipc.postMessage(data)
|
window.ipc.postMessage(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,6 @@ fn handle_ipc_message<R: Runtime>(message: String, manager: &WindowManager<R>, l
|
|||||||
cmd: String,
|
cmd: String,
|
||||||
callback: CallbackFn,
|
callback: CallbackFn,
|
||||||
error: CallbackFn,
|
error: CallbackFn,
|
||||||
#[serde(flatten)]
|
|
||||||
payload: serde_json::Value,
|
payload: serde_json::Value,
|
||||||
options: Option<RequestOptions>,
|
options: Option<RequestOptions>,
|
||||||
}
|
}
|
||||||
@ -142,7 +141,6 @@ fn handle_ipc_message<R: Runtime>(message: String, manager: &WindowManager<R>, l
|
|||||||
cmd: String,
|
cmd: String,
|
||||||
callback: CallbackFn,
|
callback: CallbackFn,
|
||||||
error: CallbackFn,
|
error: CallbackFn,
|
||||||
#[serde(flatten)]
|
|
||||||
payload: crate::utils::pattern::isolation::RawIsolationPayload<'a>,
|
payload: crate::utils::pattern::isolation::RawIsolationPayload<'a>,
|
||||||
options: Option<RequestOptions>,
|
options: Option<RequestOptions>,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user