From e8969929b70d9899bb0f959538c73da8ac0743f4 Mon Sep 17 00:00:00 2001 From: Thomas Wilburn Date: Sat, 2 Nov 2013 18:30:37 -0700 Subject: [PATCH] Added notes for project stubs --- js/projectManager.js | 19 ++++++++++++++----- js/tab.js | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/js/projectManager.js b/js/projectManager.js index 1811efb..6a05789 100644 --- a/js/projectManager.js +++ b/js/projectManager.js @@ -17,16 +17,12 @@ define([ isDirectory: false, entry: null, tab: null, - file: null, id: null, label: null, setEntry: function(entry, c) { this.entry = entry; this.label = entry.name; this.isDirectory = entry.isDirectory; - if (entry.isFile) { - this.file = new File(entry); - } }, walk: function(done) { var self = this; @@ -63,6 +59,7 @@ define([ var ProjectManager = function() { this.directories = []; + this.tabMap = {}; }; ProjectManager.prototype = { element: null, @@ -75,11 +72,23 @@ define([ }); }, render: function() { - + //nested LIs with command attributes matching IDs + }, + bindEvents: function() { + //register for tree expansion, refresh + //opening files will go through standard command flow + }, + openFile: function(id) { + //check in tabMap if it's already open + //read file + //open tab + //map the pathname in the tabMap + //register for tab close event } }; var pm = new ProjectManager(); pm.addDirectory(function() { console.log(pm) }); + command.on("project:open-file", pm.openFile.bind(pm)); }); \ No newline at end of file diff --git a/js/tab.js b/js/tab.js index 6bfa367..8424bc4 100644 --- a/js/tab.js +++ b/js/tab.js @@ -76,6 +76,8 @@ define(["command", "file"], function(command, File) { }; Tab.prototype.drop = function() { + //let listeners know, like the project manager + this._emit("close"); if (!this.file || !chrome.fileSystem.retainEntry) return; var id = this.file.retain(); if (!id) return;