start/stop on vue activation
This commit is contained in:
parent
78570ffaff
commit
83016acd3e
|
@ -57,7 +57,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import QrScanner from 'qr-scanner';
|
import QrScanner from 'qr-scanner';
|
||||||
import { onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
|
import { onActivated, onDeactivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
|
||||||
import * as misskey from 'misskey-js';
|
import * as misskey from 'misskey-js';
|
||||||
import { getScrollContainer } from '@@/js/scroll.js';
|
import { getScrollContainer } from '@@/js/scroll.js';
|
||||||
import type { ApShowResponse } from 'misskey-js/entities.js';
|
import type { ApShowResponse } from 'misskey-js/entities.js';
|
||||||
|
@ -206,12 +206,20 @@ async function startQr() {
|
||||||
qrStarted.value = true;
|
qrStarted.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stopQr() {
|
function stopQr() {
|
||||||
if (!scannerInstance.value) return;
|
if (!scannerInstance.value) return;
|
||||||
await scannerInstance.value.stop();
|
scannerInstance.value.stop();
|
||||||
qrStarted.value = false;
|
qrStarted.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onActivated(() => {
|
||||||
|
startQr;
|
||||||
|
});
|
||||||
|
|
||||||
|
onDeactivated(() => {
|
||||||
|
stopQr;
|
||||||
|
});
|
||||||
|
|
||||||
const alertLock = ref(false);
|
const alertLock = ref(false);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
Loading…
Reference in New Issue