-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbackground.js
More file actions
29 lines (25 loc) · 870 Bytes
/
background.js
File metadata and controls
29 lines (25 loc) · 870 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
(Background = function() {
init = function() {
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(openTreeView);
}
var openTreeView = function(currentTab) {
var views = chrome.extension.getViews({ type: 'tab' })
if (views.length == 0) {
chrome.tabs.create({active:true, url: "MindTabs.html"}, function(tab){})
} else {
var view = views[0]
var graphiy = view.$item.query({name: 'MindTabs'})
graphiy.open()
}
}
var onTabRemoved = function(tabId, removeInfo) {
if (!removeInfo.isWindowClosing) {
saveTabs()
} else {
var views = chrome.extension.getViews({type:'tab'})
chrome.storage.local.set({"note": views[0].$root})
}
}
init()
})()