Skip to content

Commit f06b8a8

Browse files
✨ Auto close settings page after installation
Co-authored-by: BetaHuhn <[email protected]>
1 parent ad4c506 commit f06b8a8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/options/App.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
return {
2929
detaInstance: undefined,
3030
saveText: 'Save Settings',
31-
error: undefined
31+
error: undefined,
32+
closeAfterUpdate: false
3233
}
3334
},
3435
methods: {
@@ -51,6 +52,13 @@
5152
this.saveText = 'Saved!'
5253
this.error = undefined
5354
55+
// Close window after configuration on installation
56+
if (this.closeAfterUpdate) {
57+
setTimeout(() => {
58+
window.close()
59+
}, 500)
60+
}
61+
5462
setTimeout(() => {
5563
this.saveText = 'Save Settings'
5664
}, 2000)
@@ -90,6 +98,12 @@
9098
},
9199
created() {
92100
chrome.storage.local.get((items) => {
101+
// detaInstance will be undefined on installation
102+
if (!items.detaInstance) {
103+
this.closeAfterUpdate = true
104+
return
105+
}
106+
93107
this.detaInstance = items.detaInstance
94108
})
95109
}

0 commit comments

Comments
 (0)