-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
33 lines (29 loc) · 719 Bytes
/
popup.js
File metadata and controls
33 lines (29 loc) · 719 Bytes
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
var popupRootComponent = {
data: function() {
return {
error_info: {
errors: [] // notice this is an array
}
}
},
template: `<div></div>`,
mounted: function(){
this.save();
},
methods: {
save: function(){
console.log('saving this to storage', this.error_info);
chrome.storage.local.set({error_info: this.error_info}, function(){
chrome.storage.local.get({error_info: {errors: []}}, function(obj){
console.log('saved result', obj);
// trying filter array of errors
console.log(obj.error_info.errors.filter(function(el){
el.message !== undefined
}).length);
});
});
}
}
};
var app = Vue.createApp(popupRootComponent);
popupApp = app.mount('body');