Explorar el Código

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

Lucas Fernandes Nogueira hace 9 meses
padre
commit
2e88633ba4

+ 6 - 0
.changes/remove-unused-metadata-references.md

@@ -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`.

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
crates/tauri/scripts/bundle.global.js


+ 0 - 6
crates/tauri/src/manager/mod.rs

@@ -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>> {

+ 9 - 1
packages/api/eslint.config.js

@@ -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: '^_'
+        }
+      ]
     }
   }
 ]

+ 0 - 2
packages/api/src/global.d.ts

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

+ 1 - 7
packages/api/src/mocks.ts

@@ -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 }
   }
 }

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio