mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-29 12:06:01 +02:00
cf4d7d4e6c
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import {
|
|
onOpenUrl,
|
|
getCurrent as getCurrentDeepLinkUrls
|
|
} from '@tauri-apps/plugin-deep-link'
|
|
|
|
function handler(urls: string[]) {
|
|
console.log(urls)
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
const updateIntentEl = document.querySelector('#event-intent')!
|
|
updateIntentEl.textContent = JSON.stringify(urls)
|
|
}
|
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
onOpenUrl(handler)
|
|
|
|
document.querySelector('#intent-form')?.addEventListener('submit', (e) => {
|
|
e.preventDefault()
|
|
getCurrentDeepLinkUrls()
|
|
.then((res) => {
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
const updateIntentEl = document.querySelector('#update-intent')!
|
|
updateIntentEl.textContent = res ? JSON.stringify(res) : 'none'
|
|
})
|
|
.catch(console.error)
|
|
})
|
|
|
|
getCurrentDeepLinkUrls()
|
|
.then((res) => {
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
const initialIntentEl = document.querySelector('#initial-intent')!
|
|
initialIntentEl.textContent = res ? JSON.stringify(res) : 'none'
|
|
})
|
|
.catch(console.error)
|
|
})
|