chore: remove references to unused __TAURI_INTERNALS__.metadata (#11369)

This commit is contained in:
Lucas Fernandes Nogueira
2024-10-15 13:26:43 -03:00
committed by GitHub
parent 25cc5655c0
commit 2e88633ba4
6 changed files with 17 additions and 17 deletions

View File

@@ -0,0 +1,6 @@
---
"@tauri-apps/api": patch:changes
"tauri": patch:changes
---
Remove references to no longer used `__TAURI_INTERNALS__.metadata.windows` and `__TAURI_INTERNALS__.metadata.webviews`.

File diff suppressed because one or more lines are too long

View File

@@ -631,12 +631,6 @@ impl<R: Runtime> AppManager<R> {
#[cfg(desktop)]
pub(crate) fn on_webview_close(&self, label: &str) {
self.webview.webviews_lock().remove(label);
if let Ok(webview_labels_array) = serde_json::to_string(&self.webview.labels()) {
let _ = self.webview.eval_script_all(format!(
r#"(function () {{ const metadata = window.__TAURI_INTERNALS__.metadata; if (metadata != null) {{ metadata.webviews = {webview_labels_array}.map(function (label) {{ return {{ label: label }} }}) }} }})()"#,
));
}
}
pub fn windows(&self) -> HashMap<String, Window<R>> {

View File

@@ -47,7 +47,15 @@ export default [
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/strict-boolean-expressions': 0,
'no-return-await': 'warn',
'@typescript-eslint/return-await': 'off'
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
]
}
}
]

View File

@@ -21,9 +21,7 @@ declare global {
options?: InvokeOptions
}) => void
metadata: {
windows: WindowDef[]
currentWindow: WindowDef
webviews: WebviewDef[]
currentWebview: WebviewDef
}
plugins: {

View File

@@ -136,22 +136,16 @@ export function mockIPC(
* ```
*
* @param current Label of window this JavaScript context is running in.
* @param additionalWindows Label of additional windows the app has.
*
* @since 1.0.0
*/
export function mockWindows(
current: string,
...additionalWindows: string[]
..._additionalWindows: string[]
): void {
mockInternals()
window.__TAURI_INTERNALS__.metadata = {
windows: [current, ...additionalWindows].map((label) => ({ label })),
currentWindow: { label: current },
webviews: [current, ...additionalWindows].map((label) => ({
windowLabel: label,
label
})),
currentWebview: { windowLabel: current, label: current }
}
}