Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 71f7a25

Browse files
committed
chrome notes
1 parent 87e2e93 commit 71f7a25

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/resources/assets/js/components/search-by-voice.vue

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@
1212
</template>
1313

1414
<script>
15+
// chrome: only works on https
16+
// or
17+
// chrome://flags/#unsafely-treat-insecure-origin-as-secure
1518
import annyang from 'annyang'
1619
1720
export default {
1821
props: ['trans', 'searchFor'],
1922
data() {
2023
return {
21-
run: false,
24+
run : false,
2225
isSupported: true,
23-
transcript: null
26+
transcript : null
2427
}
2528
},
2629
created() {
@@ -30,12 +33,18 @@ export default {
3033
}
3134
},
3235
mounted() {
33-
annyang.addCallback('result', (phrases) => {
34-
this.$parent.searchFor = phrases[0]
35-
})
36+
if (this.isSupported) {
37+
annyang.addCallback('result', (phrases) => {
38+
// console.log(phrases)
39+
40+
this.$parent.searchFor = phrases[0]
41+
})
42+
}
3643
},
3744
beforeDestroy() {
38-
annyang.removeCallback()
45+
if (this.isSupported) {
46+
annyang.removeCallback()
47+
}
3948
},
4049
methods: {
4150
toggle() {

0 commit comments

Comments
 (0)