-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (49 loc) · 1.56 KB
/
index.js
File metadata and controls
49 lines (49 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
let indexVue = new Vue({
el: '#main-index',
data: {
toggleLab: true
},
methods: {
dataTab: function(isLab) {
if(isLab)
chrome.tabs.create({'url': chrome.extension.getURL('labrador/export/dataView.html')});
else
chrome.tabs.create({'url': chrome.extension.getURL('export/dataView.html')});
},
toggleLabView: function () {
this.toggleLab = !this.toggleLab;
const saveLabToggle = {
action: 'save_lab_toggle',
id: indexVue.toggleLab
};
chrome.runtime.sendMessage(saveLabToggle);
},
updatePageState: function(page) {
const savePageState = {
action: 'save_page_state',
id: page
};
chrome.runtime.sendMessage(savePageState);
}
},
mounted: function() {
//this.updatePageState('/index.html');
const loadPageState = {
action: 'load_page_state'
};
const loadLabToggleState = {
action: 'load_lab_toggle'
};
chrome.runtime.sendMessage(loadPageState, response => {
if(response) {
if (response === '/index.html')
chrome.runtime.sendMessage(loadLabToggleState, response => {
if(response != null)
indexVue.toggleLab = response;
});
else
window.open(response, '_self');
}
});
}
});