feat: update dependencies
This commit is contained in:
parent
55fe1d144f
commit
3e087bd257
16 changed files with 2004 additions and 474 deletions
16
src/mocks.js
16
src/mocks.js
|
@ -19,12 +19,24 @@ function mockWindows(current, ...additionalWindows) {
|
|||
__currentWindow: { label: current }
|
||||
};
|
||||
}
|
||||
function mockConvertFileSrc(osName, windowsProtocolScheme = "https") {
|
||||
window.__TAURI__ = window.__TAURI__ ?? {};
|
||||
window.__TAURI__.convertFileSrc = function(filePath, protocol = "asset") {
|
||||
const path = encodeURIComponent(filePath);
|
||||
return osName === "windows" ? `${windowsProtocolScheme}://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}`;
|
||||
};
|
||||
}
|
||||
function clearMocks() {
|
||||
delete window.__TAURI_IPC__;
|
||||
delete window.__TAURI_METADATA__;
|
||||
if (window.__TAURI__?.convertFileSrc)
|
||||
delete window.__TAURI__.convertFileSrc;
|
||||
if (window.__TAURI_IPC__)
|
||||
delete window.__TAURI_IPC__;
|
||||
if (window.__TAURI_METADATA__)
|
||||
delete window.__TAURI_METADATA__;
|
||||
}
|
||||
export {
|
||||
clearMocks,
|
||||
mockConvertFileSrc,
|
||||
mockIPC,
|
||||
mockWindows
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue