chore(entry) move <a> handling code from q-app (#21)

This commit is contained in:
Lucas Fernandes Nogueira 2019-08-21 08:44:39 -03:00 committed by nothingismagick
parent 8adb667229
commit 88f01efbe5

View File

@ -11,6 +11,18 @@
*
**/
// open <a href="..."> links with the Tauri API
document.querySelector('body').addEventListener('click', e => {
let target = e.target
while (target != null) {
if (target.matches ? target.matches('a') : target.msMatchesSelector('a')) {
tauri.open(target.href)
break
}
target = target.parentElement
}
}, true)
/**
* @module tauri
* @description This API interface makes powerful interactions available