Added notes for project stubs

This commit is contained in:
Thomas Wilburn 2013-11-02 18:30:37 -07:00
parent 22c56da448
commit e8969929b7
2 changed files with 16 additions and 5 deletions

View file

@ -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));
});

View file

@ -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;