mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-05 10:13:00 +02:00
chore: remove references to unused __TAURI_INTERNALS__.metadata (#11369)
This commit is contained in:
committed by
GitHub
parent
25cc5655c0
commit
2e88633ba4
6
.changes/remove-unused-metadata-references.md
Normal file
6
.changes/remove-unused-metadata-references.md
Normal 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
@@ -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>> {
|
||||
|
||||
@@ -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: '^_'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
2
packages/api/src/global.d.ts
vendored
2
packages/api/src/global.d.ts
vendored
@@ -21,9 +21,7 @@ declare global {
|
||||
options?: InvokeOptions
|
||||
}) => void
|
||||
metadata: {
|
||||
windows: WindowDef[]
|
||||
currentWindow: WindowDef
|
||||
webviews: WebviewDef[]
|
||||
currentWebview: WebviewDef
|
||||
}
|
||||
plugins: {
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user