Caret/js/main.js

39 lines
894 B
JavaScript
Raw Normal View History

2013-09-13 22:57:57 +00:00
require([
"command",
"settings!user",
"keys",
"sessions",
"menus",
"palette"
], function(command, Settings) {
2013-08-20 00:53:03 +00:00
2013-08-23 23:03:46 +00:00
var frame = chrome.app.window.current();
2013-08-31 20:23:41 +00:00
//store window dimensions on resize
2013-08-23 23:03:46 +00:00
frame.onBoundsChanged.addListener(function() {
var bounds = frame.getBounds();
chrome.storage.local.set({bounds: bounds});
});
command.on("app:exit", function() {
frame.close();
});
2013-09-13 22:57:57 +00:00
var setTheme = function() {
var user = Settings.get("user");
var themes = {
"dark": "css/caret-dark.css",
"light": "css/caret.css"
};
var theme = user.uiTheme || "light";
var url = themes[theme];
document.find("#theme").setAttribute("href", url);
}
2013-09-02 01:28:31 +00:00
//the settings manager may also fire init:restart to re-init components after startup
command.fire("init:startup");
2013-09-13 22:57:57 +00:00
command.on("init:restart", setTheme);
setTheme();
2013-08-20 00:53:03 +00:00
});