Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup

  • Loading branch information...
commit aa0a621d677cba12b7ca5658eff9faf649de2fb9 1 parent 04d4c50
@crcn authored
View
41 lib/plugins/command.js
@@ -6,28 +6,41 @@ exports.plugin = function(cli, loader) {
- function getHandler(type) {
- handlers = loader.modules("command.*");
- for(var i = handlers.length; i--;) {
- var handler = handlers[i];
+ function getHandler(type, callback) {
+ loader.loadModules("^command.*$", function(err, handlers) {
+ for(var i = handlers.length; i--;) {
+ var handler = handlers[i];
+ if(handler.testListener && handler.testListener(type)) return callback(null, handler);
+ }
+
+ callback();
+ });
- if(handler.testListener(type)) return handler;
- }
}
cli.emit = function(buffer, data) {
- try {
- var handler = getHandler(buffer);
+ var ret = true;
+
+ //fucking dirty... - this is synchronous.
+ getHandler(buffer, function(err, handler) {
+ try {
+
+ if(!handler) {
+ ret = false;
+ return;
+ }
+
- if(!handler) return false;
+ return handler.run(buffer, data);
- return handler.run(buffer, data);
+ } catch(e) {
+ console.error(e.stack);
+ ret = false;
+ }
+ });
- } catch(e) {
- console.error(e.stack);
- return false;
- }
+ return ret;
}
View
2  node_modules/colors/package.json
@@ -16,5 +16,5 @@
"readme": "<h1>colors.js - get color and style in your node.js console like what</h1>\n\n<img src=\"http://i.imgur.com/goJdO.png\" border = \"0\"/>\n\n var sys = require('sys');\n var colors = require('./colors');\n\n sys.puts('hello'.green); // outputs green text\n sys.puts('i like cake and pies'.underline.red) // outputs red underlined text\n sys.puts('inverse the color'.inverse); // inverses the color\n sys.puts('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)\n \n<h2>colors and styles!</h2>\n- bold\n- italic\n- underline\n- inverse\n- yellow\n- cyan\n- white\n- magenta\n- green\n- red\n- grey\n- blue\n\n\n### Authors \n\n#### Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell, Dustin Diaz (@ded)\n",
"readmeFilename": "ReadMe.md",
"_id": "colors@0.5.1",
- "_from": "colors@0.5.1"
+ "_from": "colors@0.5.x"
}
View
40 node_modules/disposable/lib/index.js
@@ -2,11 +2,11 @@
(function() {
- var disposable = {};
+ var _disposable = {};
- disposable.create = function() {
+ _disposable.create = function() {
var self = {},
disposables = [];
@@ -14,6 +14,14 @@
self.add = function(disposable) {
+ if(arguments.length > 1) {
+ var collection = _disposable.create();
+ for(var i = arguments.length; i--;) {
+ collection.add(arguments[i]);
+ }
+ return self.add(collection);
+ }
+
if(typeof disposable == 'function') {
var disposableFunc = disposable, args = Array.prototype.slice.call(arguments, 0);
@@ -27,6 +35,9 @@
disposableFunc.apply(null, args);
}
};
+ } else
+ if(!disposable || !disposable.dispose) {
+ return false;
}
@@ -35,18 +46,27 @@
return {
dispose: function() {
var i = disposables.indexOf(disposable);
-
if(i > -1) disposables.splice(i, 1);
}
};
};
self.addTimeout = function(timerId) {
- return self.add(clearTimeout, timerId);
+ return self.add(function() {
+ clearTimeout(timerId);
+ });
};
self.addInterval = function(timerId) {
- return self.add(clearInterval, timerId);
+ return self.add(function() {
+ clearInterval(timerId);
+ });
+ };
+
+ self.addBinding = function(target) {
+ self.add(function() {
+ target.unbind();
+ });
};
@@ -66,17 +86,13 @@
if(typeof module != 'undefined') {
- module.exports = disposable;
+ module.exports = _disposable;
}
-
+ else
if(typeof window != 'undefined') {
- window.disposable = disposable;
+ window.disposable = _disposable;
}
})();
-var disposable = module.exports.create();
-
-
-disposable.dispose();
View
14 node_modules/disposable/package.json
@@ -1,12 +1,10 @@
{
"name": "disposable",
- "version": "0.0.1",
+ "version": "0.0.5",
"main": "./lib/index.js",
- "author": {
- "name": "Craig Condon"
- },
- "_id": "disposable@0.0.1",
- "readme": "ERROR: No README.md file found!",
- "description": "ERROR: No README.md file found!",
- "_from": "disposable@<0.2.0"
+ "readme": "```javascript\n\nvar disposable = require(\"disposable\")(),\nEventEmitter = require(\"events\").EventEmitter,\nem = new EventEmitter();\n\n\ndisposable.addTimeout(setTimeout(function() {\n\t\n}, 500));\n\ndisposable.addInterval(setInterval(function() {\n\t\n}, 500));\n\n\ndisposable.add(em.on(\"end\", function(){}),\nem.on(\"test\", function(){}));",
+ "readmeFilename": "README.md",
+ "_id": "disposable@0.0.5",
+ "description": "```javascript",
+ "_from": "disposable@0.0.x"
}
View
8 node_modules/outcome/.cupboard
@@ -1,9 +1,3 @@
[commands]
-proj = subl --project project.sublime-project
-start = node .
-publish = browserify ./lib/index.js -o outcome.js, closure --js=outcome.js --js_output_file=outcome.min.js, npm publish --force, git add -A, git commit -m "$@", git push origin master
+proj = subl .
-
-[ignore]
-outcome.min.js
-project.sublime-\w+
View
75 node_modules/outcome/lib/index.js
@@ -3,7 +3,6 @@ var EventEmitter = require('events').EventEmitter,
//used for dispatching unhandledError messages
globalEmitter = new EventEmitter();
-
var Chain = function(listeners) {
if(!listeners) listeners = { };
@@ -13,31 +12,34 @@ var Chain = function(listeners) {
var args = Array.apply(null, arguments), orgArgs = arguments;
- if(listeners.callback) {
- listeners.callback.apply(this, args);
+ //it might be useful to log ALL errors handled.
+ if(args[0]) {
+ globalEmitter.emit("handledError", args[0]);
+ }
+ if(listeners.callback) {
+ listeners.callback.apply(this, args);
}
if(listeners.handle) {
-
listeners.handle.apply(listeners, args);
-
} else {
//error should always be first args
- err = args.shift();
+ var err = args.shift();
//on error
if(err) {
-
listeners.error.call(this, err);
-
} else
- if(listeners.success) {
-
- listeners.success.apply(this, args);
+ if(listeners.success) {
+ try {
+ listeners.success.apply(this, args);
+ } catch(e) {
+ listeners.error.call(this, err)
+ }
}
}
@@ -48,33 +50,38 @@ var Chain = function(listeners) {
//DEPRECATED
fn.done = function(fn) {
-
return fn.callback(fn);
-
}
fn.handle = function(value) {
-
return _copy({ handle: value });
-
}
+ fn.vine = function() {
+ return fn.handle(function(resp) {
+ if(resp.errors) {
+ this.error(resp.errors);
+ } else {
+ this.success(resp.result);
+ }
+ });
+ }
+
+
fn.callback = function(value) {
-
return _copy({ callback: value });
-
}
- fn.success = function(value) {
-
+ fn.success = fn.s = function(value) {
return _copy({ success: value });
-
}
- fn.error = function(value) {
-
+ fn.error = fn.e = function(value) {
return _copy({ error: value });
+ }
+ fn.throwError = function(err) {
+ if(!globalEmitter.emit('unhandledError', err) && !listeners.callback) throw err;
}
@@ -84,8 +91,8 @@ var Chain = function(listeners) {
listeners.error = function(err) {
//no error callback? check of unhandled error is present, or throw
- if(!globalEmitter.emit('unhandledError', err) && !listeners.callback) throw err;
-
+ // if(!globalEmitter.emit('unhandledError', err) && !listeners.callback) throw err;
+ fn.throwError(err);
}
}
@@ -112,9 +119,7 @@ var Chain = function(listeners) {
module.exports = function(listeners) {
-
return Chain(listeners);
-
}
@@ -127,7 +132,7 @@ var chain = Chain();
//copy the obj keys to module.exports
Object.keys(chain).forEach(function(prop) {
-
+
//on call of error, success, callback - make a new chain
module.exports[prop] = function() {
@@ -135,14 +140,26 @@ Object.keys(chain).forEach(function(prop) {
return child[prop].apply(child, arguments);
}
+
});
+module.exports.logAllErrors = function(v) {
+ if(v) {
+ globalEmitter.on("handledError", onGlobalError);
+ } else {
+ globalEmitter.removeListener("handledError", onGlobalError);
+ }
+}
+
+
+function onGlobalError(e) {
+ console.error(e.stack);
+}
+
//running online?
if(typeof window != 'undefined') {
-
window.outcome = module.exports;
-
}
View
111 node_modules/outcome/outcome.js
@@ -7,12 +7,12 @@
var cached = require.cache[resolved];
var res = cached? cached.exports : mod();
return res;
-}
+};
require.paths = [];
require.modules = {};
require.cache = {};
-require.extensions = [".js",".coffee"];
+require.extensions = [".js",".coffee",".json"];
require._core = {
'assert': true,
@@ -139,10 +139,13 @@ require.alias = function (from, to) {
(function () {
var process = {};
+ var global = typeof window !== 'undefined' ? window : {};
+ var definedProcess = false;
require.define = function (filename, fn) {
- if (require.modules.__browserify_process) {
+ if (!definedProcess && require.modules.__browserify_process) {
process = require.modules.__browserify_process();
+ definedProcess = true;
}
var dirname = require._core[filename]
@@ -151,7 +154,14 @@ require.alias = function (from, to) {
;
var require_ = function (file) {
- return require(file, dirname);
+ var requiredModule = require(file, dirname);
+ var cached = require.cache[require.resolve(file, dirname)];
+
+ if (cached && cached.parent === null) {
+ cached.parent = module_;
+ }
+
+ return requiredModule;
};
require_.resolve = function (name) {
return require.resolve(name, dirname);
@@ -159,7 +169,13 @@ require.alias = function (from, to) {
require_.modules = require.modules;
require_.define = require.define;
require_.cache = require.cache;
- var module_ = { exports : {} };
+ var module_ = {
+ id : filename,
+ filename: filename,
+ exports : {},
+ loaded : false,
+ parent: null
+ };
require.modules[filename] = function () {
require.cache[filename] = module_;
@@ -170,15 +186,17 @@ require.alias = function (from, to) {
module_.exports,
dirname,
filename,
- process
+ process,
+ global
);
+ module_.loaded = true;
return module_.exports;
};
};
})();
-require.define("path",function(require,module,exports,__dirname,__filename,process){function filter (xs, fn) {
+require.define("path",function(require,module,exports,__dirname,__filename,process,global){function filter (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
if (fn(xs[i], i, xs)) res.push(xs[i]);
@@ -312,17 +330,24 @@ exports.basename = function(path, ext) {
exports.extname = function(path) {
return splitPathRe.exec(path)[3] || '';
};
+
});
-require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process){var process = module.exports = {};
+require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process,global){var process = module.exports = {};
process.nextTick = (function () {
- var queue = [];
+ var canSetImmediate = typeof window !== 'undefined'
+ && window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
-
+
+ if (canSetImmediate) {
+ return function (f) { return window.setImmediate(f) };
+ }
+
if (canPost) {
+ var queue = [];
window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'browserify-tick') {
ev.stopPropagation();
@@ -332,14 +357,15 @@ process.nextTick = (function () {
}
}
}, true);
- }
-
- return function (fn) {
- if (canPost) {
+
+ return function nextTick(fn) {
queue.push(fn);
window.postMessage('browserify-tick', '*');
- }
- else setTimeout(fn, 0);
+ };
+ }
+
+ return function nextTick(fn) {
+ setTimeout(fn, 0);
};
})();
@@ -362,9 +388,10 @@ process.binding = function (name) {
cwd = path.resolve(dir, cwd);
};
})();
+
});
-require.define("events",function(require,module,exports,__dirname,__filename,process){if (!process.EventEmitter) process.EventEmitter = function () {};
+require.define("events",function(require,module,exports,__dirname,__filename,process,global){if (!process.EventEmitter) process.EventEmitter = function () {};
var EventEmitter = exports.EventEmitter = process.EventEmitter;
var isArray = typeof Array.isArray === 'function'
@@ -373,6 +400,13 @@ var isArray = typeof Array.isArray === 'function'
return Object.prototype.toString.call(xs) === '[object Array]'
}
;
+function indexOf (xs, x) {
+ if (xs.indexOf) return xs.indexOf(x);
+ for (var i = 0; i < xs.length; i++) {
+ if (x === xs[i]) return i;
+ }
+ return -1;
+}
// By default EventEmitters will print a warning if more than
// 10 listeners are added to it. This is a useful default which
@@ -509,7 +543,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {
var list = this._events[type];
if (isArray(list)) {
- var i = list.indexOf(listener);
+ var i = indexOf(list, listener);
if (i < 0) return this;
list.splice(i, 1);
if (list.length == 0)
@@ -535,9 +569,10 @@ EventEmitter.prototype.listeners = function(type) {
}
return this._events[type];
};
+
});
-require.define("/index.js",function(require,module,exports,__dirname,__filename,process){var EventEmitter = require('events').EventEmitter,
+require.define("/index.js",function(require,module,exports,__dirname,__filename,process,global){var EventEmitter = require('events').EventEmitter,
//used for dispatching unhandledError messages
globalEmitter = new EventEmitter();
@@ -553,15 +588,11 @@ var Chain = function(listeners) {
var args = Array.apply(null, arguments), orgArgs = arguments;
if(listeners.callback) {
-
listeners.callback.apply(this, args);
-
}
if(listeners.handle) {
-
listeners.handle.apply(listeners, args);
-
} else {
//error should always be first args
@@ -569,14 +600,11 @@ var Chain = function(listeners) {
//on error
if(err) {
-
listeners.error.call(this, err);
-
} else
+
if(listeners.success) {
-
listeners.success.apply(this, args);
-
}
}
@@ -587,33 +615,34 @@ var Chain = function(listeners) {
//DEPRECATED
fn.done = function(fn) {
-
return fn.callback(fn);
-
}
fn.handle = function(value) {
-
return _copy({ handle: value });
-
}
+ fn.vine = function() {
+ return fn.handle(function(resp) {
+ if(resp.errors) {
+ this.error(resp.errors);
+ } else {
+ this.success(resp.result);
+ }
+ });
+ }
+
+
fn.callback = function(value) {
-
return _copy({ callback: value });
-
}
- fn.success = function(value) {
-
+ fn.success = fn.s = function(value) {
return _copy({ success: value });
-
}
- fn.error = function(value) {
-
+ fn.error = fn.e = function(value) {
return _copy({ error: value });
-
}
@@ -624,7 +653,6 @@ var Chain = function(listeners) {
//no error callback? check of unhandled error is present, or throw
if(!globalEmitter.emit('unhandledError', err) && !listeners.callback) throw err;
-
}
}
@@ -651,9 +679,7 @@ var Chain = function(listeners) {
module.exports = function(listeners) {
-
return Chain(listeners);
-
}
@@ -687,6 +713,7 @@ if(typeof window != 'undefined') {
+
});
require("/index.js");
})();
View
6 node_modules/outcome/package.json
@@ -5,13 +5,13 @@
"name": "Craig Condon"
},
"repository": {},
- "version": "0.0.6",
+ "version": "0.0.12",
"engines": {},
"dependencies": {},
"devDependencies": {},
"main": "./lib/index.js",
"readme": "\n\nOutcome.js is a simple flow-control library which wraps your `.callback(err, result)` functions. \n\n### Motiviation\n\n- Write less code for handling errors.\n- Easier to maintain.\n- Keep error handling code separate. \n\n\n\n### Basic Example\n\nHere's the traditional method of handling errors:\n\n```javascript\n\nvar fs = require('fs');\n\nfunction doSomething(path, callback) {\n\n\tfs.realpath(path, onRealPath);\n\n\tfunction onRealPath(err, path) {\n\t\tif(err) return callback(err);\n\t\tfs.lstat(path, onStat);\n\t}\n\n\tfunction onStat(err, stats) {\n\t\tif(err) return callback(err);\n\t\tcallback(err, stats);\n\t}\n\n}\n\ndoSomething('/path/to/something', function(err, result) {\n\t\n\t//inline with result handling - yuck\n\tif(err) {\n\n\t\t//do something with error\n\t\treturn;\n\t}\n\n\t//do something with result\n})\n```\n\nThe outcome.js way:\n\n```javascript\n\nvar fs = require('fs'),\noutcome = require('outcome');\n\nfunction doSomething(path, callback) {\n\n\t//wrap the callback around an error handler so any errors in *this* function\n\t//bubble back up to the callback - I'm lazy and I don't wanna write this stuff...\n\tvar on = outcome.error(callback);\n\n\t//on success, call onRealPath. Any errors caught will be sent back\n\t//automatically\n\tfs.realpath(path, on.success(onRealPath));\n\n\tfunction onRealPath(path) {\n\n\t\t//ONLY call onStat if we've successfuly grabbed the file stats\n\t\tfs.lstat(path, on.success(onStat));\n\t}\n\n\tfunction onStat(stats) {\n\n\t\t//no errors, so send a response back\n\t\tcallback(null, stats);\n\t}\n}\n\n\nvar on = outcome.error(function(error) {\n\t//do something with error\n}));\n\ndoSomething('/path/to/something', on.success(function(response) {\n\t//do something with result\n}));\n\n```\n\n## API\n\n### outcome(listeners)\n\n- `listeners` - Object of listeners you want to attach to outcome.\n\n```javascript\n\nvar onResult = outcome({\n\t\n\t//called when an error is caught\n\terror: function(error) {\n\t\t\n\t},\n\n\t//called when an error is NOT present\n\tsuccess: function(result, thirdParam) {\n\t\t\n\t},\n\n\t//called back when an error, or result is present\n\tcallback: function(err, result, thirdParam) {\n\t\t\n\t}\n})\n\n```\n\nAs shown in the example above, you can also wrap-around an existing callback:\n\n```javascript\nvar onResult = outcome.error(function(error) {\n\t\n}).\nsuccess(function(result, thirdParam) {\n\t\n}).\ncallback(function(error, result, thirdParam) {\n\t\n});\n```\n\n\nBy default, any unhandled errors are thrown. To get around this, you'll need to listen for an `unhandledError`:\n\n```javascript\noutcome.on('unhandledError', function(error) {\n\t//report bugs here..., then throw again.\n});\n\n\n//fails\nfs.stat('s'+__filename, outcome.success(function() {\n\n\n});\n```\n\n\n\n### .callback()\n\nCalled when on error/success. `Same as function(err, data) { }`\n\nHere's a redundant example:\n\n```javascript\n\nfs.stat(__filename, outcome.error(function(err) {\n\t//handle error\n}).success(function(data) {\n\t//handle result\n}.callback(function(err, result) {\n\t//called on fn complete regardless if there's an error, or success\n}));\n\n```\n\n### .success(fn)\n\nCalled on Success.\n\n```javascript\nvar onOutcome = outcome.success(function(data, anotherParam, andAnotherParam) {\n\t//handle success data\n});\n\nonOutcome(null, \"success!\", \"more data!\", \"more results..\");\n```\n\n### .error(fn)\n\nCalled on error.\n\n```javascript\n\nvar onOutcome = outcome.error(function(err) {\n\t\n});\n\nonOutcome(new Error(\"something went wrong...\")); \n```\n\n### .handle(fn)\n\nCustom response handler\n\n```javascript\n\noutcome.handle(function(response) {\n\t\n\tif(response.errors) this.error(response);\n\tif(response.data) this.success(response);\n});\n\n```\n\n\n## CoffeeScript Example\n\n```coffeescript\n\noutcome = require \"outcome\"\n\ndoSomething(path, callback) ->\n\t\n\ton = outcome.error callback\n\n\t# first get the realpath\n\tfs.realpath path, on.success onRealPath\n\n\t# on real path, get stats\n\tonRealPath(path) -> fs.lstat path, on.success onStat\n\n\t# on stat, finish\n\tonStat(stats) -> callback null, stats\n\n\n# call do something\ndoSomething '/path/to/something', outcome \n\n\tsuccess: (statis) ->\n\t\t# do something\n\n\terror: (error) ->\n\t\t# do something else\n\n\n```\n\n\n### Note\n\nCalling `.error()`, `.success()`, `.callback()` generates a new function which copies the previous listeners. \nCheckout [fs-test](outcome.js/blob/master/examples/fs-test.js) in the [examples](outcome.js/blog/master/examples) folder.\n",
"readmeFilename": "README.md",
- "_id": "outcome@0.0.6",
- "_from": "outcome@<0.2.0"
+ "_id": "outcome@0.0.12",
+ "_from": "outcome@0.0.x"
}
View
23 node_modules/outcome/project.sublime-project
@@ -1,23 +0,0 @@
-{
- "folders":
- [
- {
- "path": "."
- }
- ],
- "build_systems":
- [
- {
- "name":"cbd make",
- "cmd":["cbd","make","result.js"]
- },
- {
- "name":"cbd start",
- "cmd":["cbd","start","result.js"]
- },
- {
- "name":"cbd make+start",
- "cmd":["cbd","make+start","result.js"]
- }
- ]
-}
View
1,258 node_modules/outcome/project.sublime-workspace
@@ -1,1258 +0,0 @@
-{
- "auto_complete":
- {
- "selected_items":
- [
- ]
- },
- "buffers":
- [
- {
- "contents": "",
- "file": "/tmp/subl stdin 57e8mA.txt",
- "file_size": -1,
- "file_write_time": -1,
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "contents": "",
- "file": "/tmp/subl stdin pREMSl.txt",
- "file_size": -1,
- "file_write_time": -1,
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "lib/index.js",
- "settings":
- {
- "buffer_size": 2253,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin SVU98k.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin cZgAdw.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin LFxbDT.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin Ww2oPb.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin D6g4SP.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin A9h9Pf.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin H6yuTB.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin bpCmHE.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin VYLw0M.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin 877Eom.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin b284jE.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/Users/craig/Library/Application Support/Sublime Text 2/Packages/User/Base File.sublime-settings",
- "settings":
- {
- "buffer_size": 99,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin 9nheXs.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "examples/fs-test.js",
- "settings":
- {
- "buffer_size": 689,
- "line_ending": "Unix"
- }
- },
- {
- "file": "examples/basic-test.js",
- "settings":
- {
- "buffer_size": 318,
- "line_ending": "Unix"
- }
- },
- {
- "file": "examples/test3.js",
- "settings":
- {
- "buffer_size": 722,
- "line_ending": "Unix"
- }
- },
- {
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "examples/test.html",
- "settings":
- {
- "buffer_size": 397,
- "line_ending": "Unix"
- }
- },
- {
- "file": "README.md",
- "settings":
- {
- "buffer_size": 4277,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin fcarB4.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin zZHbVh.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin HOWgA6.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin 002d3j.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "outcome.js",
- "settings":
- {
- "buffer_size": 16840,
- "line_ending": "Unix"
- }
- },
- {
- "file": ".cupboard",
- "settings":
- {
- "buffer_size": 301,
- "line_ending": "Unix"
- }
- },
- {
- "contents": "",
- "file": "/tmp/subl stdin ITMk6f.txt",
- "file_size": -1,
- "file_write_time": -1,
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin LDuRnL.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- }
- ],
- "build_system": "",
- "command_palette":
- {
- "height": 0.0,
- "selected_items":
- [
- ],
- "width": 0.0
- },
- "console":
- {
- "height": 136.0
- },
- "distraction_free":
- {
- "menu_visible": true,
- "show_minimap": false,
- "show_open_files": false,
- "show_tabs": false,
- "side_bar_visible": false,
- "status_bar_visible": false
- },
- "file_history":
- [
- "/Users/craig/Developer/Public/outcome.js/package.json",
- "/Users/craig/Dropbox/Developer/Public/outcome.js/README.md",
- "/Volumes/minimac/Users/craig/Dropbox/Developer/Public/outcome.js/README2.md",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.core/delegate.js",
- "/tmp/subl stdin OQlyq7.txt",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.core/index.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.part.saved.core/index.js",
- "/tmp/subl stdin qsZnjK.txt",
- "/Users/craig/.cupboard/projects/spice.io/package.json",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.part.saved.subscription.core/index.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.part.saved.subscription.email/views.js",
- "/tmp/subl stdin Zr54LN.txt",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.part.saved.subscription.email/index.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/spice.io.core/index.js",
- "/Volumes/minimac/Users/craig/Dropbox/Developer/Jobs/Spice/private/spice.io/beans/spice.io.core/index.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/scraper.core/index.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/scraper.part.diffbot/index.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/scraper.core/models.js",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.part.saved.core/delegates.js",
- "/tmp/subl stdin Y5cgQv.txt",
- "/tmp/subl stdin zucUyb.txt",
- "/tmp/subl stdin bQj27x.txt",
- "/tmp/subl stdin kEyqmE.txt",
- "/tmp/subl stdin 4NoBGn.txt",
- "/tmp/subl stdin gglrIy.txt",
- "/Users/craig/.cupboard/projects/spice.io/beans/groups.part.saved.subscription.core/delegate.js",
- "/tmp/subl stdin 0CxPWS.txt",
- "/tmp/subl stdin JM3wx6.txt",
- "/tmp/subl stdin igWXJJ.txt",
- "/Users/craig/.cupboard/projects/spice.io/beans/auth.profile/index.js",
- "/tmp/subl stdin a4gRDo.txt",
- "/Users/craig/.cupboard/projects/spice.io/bootstrap.js",
- "/tmp/subl stdin jBgTW0.txt",
- "/Users/craig/.cupboard/projects/spice.io/beans/account.storage/models.js"
- ],
- "find":
- {
- "height": 34.0
- },
- "find_in_files":
- {
- "height": 0.0,
- "where_history":
- [
- ]
- },
- "find_state":
- {
- "case_sensitive": false,
- "find_history":
- [
- ".error",
- "Motiv",
- "self",
- "parent",
- "onResult",
- ".done",
- "callback",
- "done",
- "result",
- "ret",
- "globalEmitter",
- "ret =",
- ".listen",
- "wrapResultFn",
- "outcome.",
- "onOutcome2",
- "wrapResultFn",
- "call",
- "listen",
- "profile",
- "channel",
- "secret",
- "channel",
- "token'",
- "token",
- "profile/a",
- "config",
- "closestB",
- "closestBit",
- "'push",
- "groups/:group/id",
- "groups/:g",
- "getOneGroup",
- "does not ",
- "unsubscribeUrl",
- "unsubscr",
- "console.l",
- "subscriber",
- "curated",
- "send/subscription/by/group",
- "curatedBy",
- "sending sub",
- "thyme/j",
- "beans",
- "groupId",
- "getSavedArticles",
- "notifySubscribers",
- "trySending",
- "updateSubscriptionInfo",
- "trySending",
- "onSubscriptionInfo",
- "login",
- "getToken",
- "args",
- "--all"
- ],
- "highlight": true,
- "in_selection": false,
- "preserve_case": false,
- "regex": false,
- "replace_history":
- [
- ],
- "reverse": false,
- "show_context": true,
- "use_buffer2": true,
- "whole_word": false,
- "wrap": true
- },
- "groups":
- [
- {
- "selected": 2,
- "sheets":
- [
- {
- "buffer": 0,
- "file": "/tmp/subl stdin 57e8mA.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 1,
- "file": "/tmp/subl stdin pREMSl.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 2,
- "file": "lib/index.js",
- "settings":
- {
- "buffer_size": 2253,
- "regions":
- {
- },
- "selection":
- [
- [
- 1782,
- 1782
- ]
- ],
- "settings":
- {
- "syntax": "Packages/JavaScript/JavaScript.tmLanguage",
- "translate_tabs_to_spaces": false
- },
- "translation.x": 0.0,
- "translation.y": 1034.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 3,
- "file": "/tmp/subl stdin SVU98k.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 4,
- "file": "/tmp/subl stdin cZgAdw.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 5,
- "file": "/tmp/subl stdin LFxbDT.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 6,
- "file": "/tmp/subl stdin Ww2oPb.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 7,
- "file": "/tmp/subl stdin D6g4SP.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 8,
- "file": "/tmp/subl stdin A9h9Pf.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 9,
- "file": "/tmp/subl stdin H6yuTB.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 10,
- "file": "/tmp/subl stdin bpCmHE.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 11,
- "file": "/tmp/subl stdin VYLw0M.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 12,
- "file": "/tmp/subl stdin 877Eom.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 13,
- "file": "/tmp/subl stdin b284jE.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 14,
- "file": "/Users/craig/Library/Application Support/Sublime Text 2/Packages/User/Base File.sublime-settings",
- "settings":
- {
- "buffer_size": 99,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/JavaScript/JSON.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 15,
- "file": "/tmp/subl stdin 9nheXs.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 16,
- "file": "examples/fs-test.js",
- "settings":
- {
- "buffer_size": 689,
- "regions":
- {
- },
- "selection":
- [
- [
- 312,
- 312
- ]
- ],
- "settings":
- {
- "syntax": "Packages/JavaScript/JavaScript.tmLanguage",
- "translate_tabs_to_spaces": false
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 17,
- "file": "examples/basic-test.js",
- "settings":
- {
- "buffer_size": 318,
- "regions":
- {
- },
- "selection":
- [
- [
- 108,
- 108
- ]
- ],
- "settings":
- {
- "syntax": "Packages/JavaScript/JavaScript.tmLanguage",
- "translate_tabs_to_spaces": false
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 18,
- "file": "examples/test3.js",
- "settings":
- {
- "buffer_size": 722,
- "regions":
- {
- },
- "selection":
- [
- [
- 269,
- 274
- ]
- ],
- "settings":
- {
- "syntax": "Packages/JavaScript/JavaScript.tmLanguage",
- "translate_tabs_to_spaces": false
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 19,
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "default_dir": "/Users/craig/Dropbox/Developer/Public/outcome.js/examples",
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 20,
- "file": "examples/test.html",
- "settings":
- {
- "buffer_size": 397,
- "regions":
- {
- },
- "selection":
- [
- [
- 397,
- 397
- ]
- ],
- "settings":
- {
- "syntax": "Packages/HTML/HTML.tmLanguage",
- "translate_tabs_to_spaces": false
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 21,
- "file": "README.md",
- "settings":
- {
- "buffer_size": 4277,
- "regions":
- {
- },
- "selection":
- [
- [
- 218,
- 218
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Markdown/Markdown.tmLanguage",
- "translate_tabs_to_spaces": false
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 22,
- "file": "/tmp/subl stdin fcarB4.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 23,
- "file": "/tmp/subl stdin zZHbVh.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 24,
- "file": "/tmp/subl stdin HOWgA6.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 25,
- "file": "/tmp/subl stdin 002d3j.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 26,
- "file": "outcome.js",
- "settings":
- {
- "buffer_size": 16840,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/JavaScript/JavaScript.tmLanguage",
- "tab_size": 2,
- "translate_tabs_to_spaces": true
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 27,
- "file": ".cupboard",
- "settings":
- {
- "buffer_size": 301,
- "regions":
- {
- },
- "selection":
- [
- [
- 281,
- 281
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 28,
- "file": "/tmp/subl stdin ITMk6f.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- },
- {
- "buffer": 29,
- "file": "/tmp/subl stdin LDuRnL.txt",
- "settings":
- {
- "buffer_size": 0,
- "regions":
- {
- },
- "selection":
- [
- [
- 0,
- 0
- ]
- ],
- "settings":
- {
- "syntax": "Packages/Text/Plain text.tmLanguage"
- },
- "translation.x": 0.0,
- "translation.y": 0.0,
- "zoom_level": 1.0
- },
- "type": "text"
- }
- ]
- }
- ],
- "incremental_find":
- {
- "height": 0.0
- },
- "input":
- {
- "height": 28.0
- },
- "layout":
- {
- "cells":
- [
- [
- 0,
- 0,
- 1,
- 1
- ]
- ],
- "cols":
- [
- 0.0,
- 1.0
- ],
- "rows":
- [
- 0.0,
- 1.0
- ]
- },
- "menu_visible": true,
- "replace":
- {
- "height": 62.0
- },
- "save_all_on_build": true,
- "select_file":
- {
- "height": 0.0,
- "selected_items":
- [
- ],
- "width": 0.0
- },
- "select_project":
- {
- "height": 0.0,
- "selected_items":
- [
- ],
- "width": 0.0
- },
- "show_minimap": true,
- "show_open_files": false,
- "show_tabs": true,
- "side_bar_visible": true,
- "side_bar_width": 257.0,
- "status_bar_visible": true
-}
View
4 node_modules/structr/.cupboard
@@ -1,5 +1,3 @@
[commands]
-proj = subl --project project.sublime-project
+proj = subl .
-[ignore]
-project.sublime-\w+
View
21 node_modules/structr/README.md
@@ -517,27 +517,6 @@ else
Tips:
----
-* Use underscores before any private method / property.
-
-E.g:
-
-
-```javascript
-
-var SomeClass = Structr({
-
- "__construct": function ()
- {
- this._myPrivateVariable = "some private value";
- },
-
- "_myPrivateMethod": function ()
- {
- //private stuff here
- }
-});
-
-```
* Wrap methods / properties in single, or double quotes.
* Avoid the over-use of override, or overloaded methods.
View
5 node_modules/structr/examples/overloading.js
@@ -6,7 +6,7 @@ var OverloadedClass = Structr({
this._name = name;
},
'1 getName': function(name, callback)
- {
+ {
this._name = name;
this.getName(callback);
},
@@ -50,9 +50,10 @@ test1.getName('jake', function(name)
console.log(name)
});
+console.log(test1.getName());
var test2 = new OverloadedSubClass('Craig')
-test2.getName('jake', function(name)
+test2.getName('john', function(name)
{
console.log(name)
});
View
16 node_modules/structr/examples/static.js
@@ -1,13 +1,27 @@
-var MySingleton = Structr({
+var structr = require("../");
+
+var MySingleton = structr({
'static getInstance': function()
{
return this._instance || (this._instance = new MySingleton());
+ },
+ "implicit FOO": {
+ "set": function(value) {
+ console.log("G")
+ throw new Error("cannot override constant");
+ },
+ "get": function() {
+ return "BAR"
+ }
}
})
var test1 = MySingleton.getInstance();
test2 = MySingleton.getInstance();
+console.log(test2.__private)
+test1.FOO = "BLARG"
+console.log(test1);
test1.name = 'Hello World!';
View
11 node_modules/structr/lib/index.js
@@ -458,12 +458,14 @@ Structr.parseMetadata = function(metadata) {
Structr.extend = function () {
var from = {},
- mixins = Array.apply([], arguments),
+ mixins = Array.prototype.slice.call(arguments, 0),
to = mixins.pop();
-
if(mixins.length > 1) {
- from = Structr.extend.apply(null, mixins);
+ for(var i = 0, n = mixins.length; i < n; i++) {
+ var mixin = mixins[i];
+ from = Structr.extend(from, typeof mixin == "function" ? mixin.prototype : mixin);
+ }
} else {
from = mixins.pop() || from;
}
@@ -472,6 +474,7 @@ Structr.extend = function () {
//class? fetch the prototype
if(typeof from == 'function') {
+
var fromConstructor = from;
//copy the prototype to make sure we don't modify it.
@@ -488,7 +491,7 @@ Structr.extend = function () {
__private: {
//contains modifiers for all properties of object
- propertyModifiers: {}
+ propertyModifiers: { }
}
};
View
6 node_modules/structr/package.json
@@ -1,7 +1,7 @@
{
"name": "structr",
"description": "Clean OO structure for Javascript.",
- "version": "0.2.2",
+ "version": "0.2.3",
"author": {
"name": "Craig Condon"
},
@@ -10,8 +10,8 @@
"url": "http://github.com/spiceapps/Structr.git"
},
"main": "./lib/index.js",
- "readme": "Structr - Structure for Javascript \n======================================== \n\nStructr is a framework with the following goals:\n \n* Lightweight.\n# Fast.\n* Provide as few new concepts as possible coming from OOP.\n* Easy to learn.\n* Help develop re-useable, clean, and consistent code. \n* Reduce the amount of reduntant/boilerplate code. \n\n\n### Supported Operators: \n \n* _super \n* inheritance \n* overloading methods\n* Implicit / Explicit getters & setters\n* Override, and Static \n* abstract methods\n* add your own custom operators (mixins)\n\n\n### Third-party mixins\n\n* [asyngleton](/crcn/asyngleton.js) - asynchronous singletons\n* [step](/crcn/structr-step) \n \n\n\n### Installation\n\nNode.js: \n\n\tnpm install structr\n\t\t \n\t\t\n### .structr([...parents], classObject)\n\n\n```javascript\n\nvar EventEmitter = require(\"events\").EventEmitter,\nstructr = require(\"structr\");\n \n/**\n * create a mouse class which extends the node.js event emitter\n */\n\nvar Mouse = structr(EventEmitter, { \n\n\t/**\n\t */\n\n\t\"__construct\": function() {\n\t\tthis._super();\n\n\t\t//initial coords\n\t\tthis.move(0, 0);\n\t},\n\n\t/**\n\t * moves the mouse\n\t */\n\n\t\"move\": function(x, y) {\n\t\tthis.position({ x: x, y: y});\n\t},\n\n\t/**\n\t * second version of move incase an object is provided\n\t */\n\n\t\"second move\": function(position) {\n\t\tthis.position(position);\n\t},\n\n\t/**\n\t * getter / setter for the position\n\t */\n\n\t\"explicit position\": {\n\t\t\"get\": function() {\n\t\t\treturn this._position;\n\t\t},\n\t\t\"set\": function(value) {\n\t\t\tthis._position = value;\n\t\t\tthis.emit(\"move\");\n\t\t}\n\t} \n}); \n\nvar mouse = new Mouse();\n\n//listen for when the mouse has moved\nmouse.on(\"move\", function() {\n\tconsole.log(\"mouse moved!\");\n})\n\n//move 100 px left, and 100 px from the top\nmouse.move(100, 100);\n\n```\n\n\n### Class.extend(target, [...mixins]);\n\nExtends a class\n\n\n```javascript\n\nvar fs = require(\"fs\"),\nstructr = require(\"structr\"),\nmkdirp = require(\"mkdirp\"),\npath = require(\"path\");\n\n//mixin the singleton plugin\nstructr.mixin(require(\"asyngleton\"));\n\n/**\n * base cache interface\n */\n\nvar AbstractCache = structr({\n\t\n\t/**\n\t * returns a cached value\n\t */\n\n\t\"abstract get\": function(key, onGet) { },\n\n\t/**\n\t * sets a cached value\n\t */\n\n\t\"abstract set\": function(key, value, onSet) { }\n});\n\n/**\n * memory cache\n */\n\nvar MemoryCache = AbstractCache.extend({\n\t\n\t/**\n\t */\n\n\t\"__construct\": function() {\n\t\tthis._collection = {};\n\t},\n\n\t/**\n\t */\n\n\t\"get\": function(key, onGet) {\n\t\tonGet(null, this._collection[key]);\n\t},\n\n\t/**\n\t */\n\n\t\"set\": function(key, value, onSet) {\n\t\tthis._collection[key] = value;\n\t\tif(onSet) onSet(null, value);\n\t}\n});\n\n\n/**\n */\n\nvar FsCache = MemoryCache.extend({\n\t\t\n\t/**\n\t */\n\n\t\"override __construct\": function(path) {\n\t\tthis._path = path;\n\t\tthis._super();\n\t},\n\n\t/**\n\t */\n\n\t\"override set\": function() {\n\t\tthis._super.apply(this, arguments);\n\t\tthis._save();\n\t},\n\n\t/**\n\t */\n\n\t\"override get\": function(key, onKey) {\n\t\tvar _super = this._super;\n\n\t\t//load the fs cache before getting the value - this only happens ONCE \n\t\t//since _load is an asynchronous singleton.\n\t\tthis._load(function() {\n\t\t\t_super(key, onKey);\n\t\t});\n\t},\n\n\n\t/**\n\t * saves the collection to disc\n\t */\n\n\t\"_save\": function() {\n\t\tif(this._saving) return;\n\t\tthis._saving = true;\n\n\t\tvar self = this;\n\n\t\t//make the directory incase it doesn't exist. \n\t\tthis._mkdir(path.dirname(this._path), function() {\n\n\t\t\t//write the json file, with the json content\n\t\t\tfs.writeFile(self._path, JSON.parse(self._collection), function(err result) {\n\n\t\t\t\t//give some time before unlocking the save method. \n\t\t\t\t//We don't want to hit fs.write on each set\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tself._saving = false;\n\t\t\t\t}, 2000);\n\t\t\t});\n\t\t});\n\t},\n\n\t/**\n\t * loads the fs cache into memory\n\t */\n\n\t\"singleton _load\": function(onLoad) {\n\t\ttry {\n\t\t\tthis._collection = require(this._path);\n\t\t} catch(e) {\n\t\t\t//do nothing - the file doesn't exist\n\t\t}\n\t\tonLoad();\n\t},\n\n\t/**\n\t * makes the fs cache directory incase it's nested. Only happens ONCE on save.\n\t */\n\n\t\"singleton _mkdir\": function(onMkdir) {\n\t\tmkdirp(path.dirname(this._path), onMkdir);\n\t}\n});\n\n\nvar cache = new FsCache(__dirname + \"/test.json\");\n\n\ncache.get(\"name\", function(err, name) {\n\n\tif(name) {\n\t\treturn console.log(\"hello %s!\", name);\n\t}\n\n\tcache.set(\"name\", \"craig\", function() {\n\t\tconsole.log(\"saved!\");\n\t});\n});\n\n```\n\n### Modifiers \n \n### Overriding Methods\n\nMethods overridden have access to the _super property.\n\n```javascript\n\n\"override __construct\": function ()\n{\n\tthis._super();\n}\n\n```\n\n### Overwriting Methods\n \nFaster if you don't plan on using _super.\n\n\n```javascript\n\n\"__construct\": function ()\n{\n\t//cannot access _super __construct\n}\n\n```\n\t\n\t\n### Overloading Methods (Experimental)\n\nOverloading methods allows you to write methods which are mapped out depending on the number of parameters used. You must provide your own identifier (it could be anything) for each overloaded method, otherwise you'll simply be overwriting methods. For this example, I separate methods based on their order, e.g. `one`, `two`, `three`, etc.\n\n\n```javascript\n\nvar Person = Structr({\n\n\t\"sayHello\": function (name, callback)\n\t{\n\t\tthis._name = name;\n\t\tthis.sayHello(callback);\n\t},\n\n\t\"second sayHello\": function (callback)\n\t{\n\t\tcallback(this.sayHello());\n\t},\n\n\t\"third sayHello\": function ()\n\t{\n\t\treturn 'Hello ' + this._name;\n\t}\n});\n\nvar SubPerson = Person.extend({\n\n\t\"override sayHello\": function (callback)\n\t{\n\t\tcallback(this.sayHello() + \" Do you like italian food?\");\n\t},\n\n\t\"override second sayHello\": function ()\n\t{\n\t\treturn \"Hello \" + this._name + \", how are you doing today?\";\n\t}\n});\n\n\nvar p = new SubPerson();\np.sayHello(\"Craig\", function(message)\n{\n\talert(message); //Hello Craig. how are you doing today? Do you like italian food?\n});\n\n```\n\n### Static Keyword \n\nProperties, and methods set to the class versus objects instantiated.\n\n\n```javascript\n\nvar Singleton = Structr({\n\t\n\t\"static getInstance\": function ()\n\t{\n\t\treturn this._instance || (this._instance = new Singleton());\n\t}\n});\n\nvar test1 = Singleton.getInstance();\nvar test2 = Singleton.getInstance();\ntest2.name = 'Craig';\n\nconsole.log(test1.name); //Craig\n\n```\n\n### Getters & Setters \n\nBoth Implicit / Explicit methods are supported, however implicit getters & setters aren't supported in all browsers. Use implicit get/set if you're doing any development under a specific platform such as Node.js, or Appcelerator Titanium.\n\n\n\n```javascript\n\nvar GSTestClass = Structr({\n\n\t\"explicit explicitValue\": {\n\t\t\"get\": function ()\n\t\t{\n\t\t\treturn this._name;\n\t\t},\n\t\t\"set\": function (value)\n\t\t{\n\t\t\tthis._name = value;\n\t\t}\n\t},\n\t\n\t\"implicit implicitValue\": {\n\t\t\"get\": function ()\n\t\t{\n\t\t\treturn this._name;\n\t\t},\n\t\t\"set\": function (value)\n\t\t{\n\t\t\tthis._name = value;\n\t\t}\n\t},\n\t\n\t\"explicit explicitValue2\":true\n});\n\n\nvar test = new GSTestClass();\ntest.explicitValue('Craig'); \nconsole.log(test.explicitValue());\n\ntest.implicitValue = 'Tim';\nconsole.log(test.implicitValue);//Tim\nconsole.log(test.explicitValue());//Tim\n\ntest.explicitValue2('hello world');\nconsole.log(test.explicitValue2());//hello world\n\t\n```\n\nMetadata \n--------\n\nCustom modifiers are considered metadata. Use them to identify how specific methods should be handled.\n\n\n```javascript\n\n\nvar MetadataTestClass = Structr({\n\t\n\t\"myCustomMetadata test\": function ()\n\t{\n\t\treturn \"Hello Test\";\n\t}\n}));\n\n\nconsole.log(MetadataTestClass.prototype.test.myCustomMetadata); //true\n\n```\n\t\n\t\n###Bindable Metadata\n\nTo add. Makes a property bindable for change. Psuedocode:\n\n\n```javascript\n\nvar Person = Structr({\n\t\n\t\"__construct\": function(name)\n\t{\n\t\tthis.name(name);\n\t\t\n\t\tBindable.apply(this);\n\t},\n\t\n\t\"bindable explicit name\": 1\n});\n\n\nvar person1 = new Person(\"craig\");\n\n//listen for any change to name\nperson1.name.subscribe(function(newName)\n{\n\talert('Name changed to '+newName);\n});\n\n//on change the subscribers will be triggered\nperson1.name(\"Craig\");\n\n```\n\t\n###Setting Metadata\n\nTo add. Easy way to store settings on the user's computer. Psuedocode:\n\n\n```javascript\n\nvar User = Structr({\n\n\t\"__construct\": function ()\n\t{\n\t\tSettingManager.apply(this);\n\t},\n\t\n\t\"login\": function ()\n\t{\n\t\t\n\t\t//set the account info which will be saved as a cookie\n\t\tthis.accountInfo({ name: \"Craig\", last: \"Condon\", token: \"XXXXXXXXXX\" })\n\t},\n\t\n\t\"setting explicit accountInfo\": 1\n});\n\n\nvar u = new User();\n\n//this gets passed once\nif(!u.accountInfo)\n{\n\tu.login();\n}\nelse\n{\n\t//pulled from local computer\n\talert(u.accountInfo.name);\n}\n\n```\n\t\n\t\nTips:\n----\n\n* Use underscores before any private method / property. \n\nE.g: \n\n\n```javascript\n\nvar SomeClass = Structr({\n\t\n\t\"__construct\": function ()\n\t{\n\t\tthis._myPrivateVariable = \"some private value\";\n\t},\n\t\n\t\"_myPrivateMethod\": function ()\n\t{\n\t\t//private stuff here\n\t}\n});\n\n```\n\t\n* Wrap methods / properties in single, or double quotes. \n* Avoid the over-use of override, or overloaded methods.\n* Only use Structr where you would create prototyped classes.\n\n\nTo Do:\n------\n\n- change _super(...) to _super({ method: [args] }), or _super('method').call(...);\n\n\t\n\n\n",
+ "readme": "Structr - Structure for Javascript \n======================================== \n\nStructr is a framework with the following goals:\n \n* Lightweight.\n# Fast.\n* Provide as few new concepts as possible coming from OOP.\n* Easy to learn.\n* Help develop re-useable, clean, and consistent code. \n* Reduce the amount of reduntant/boilerplate code. \n\n\n### Supported Operators: \n \n* _super \n* inheritance \n* overloading methods\n* Implicit / Explicit getters & setters\n* Override, and Static \n* abstract methods\n* add your own custom operators (mixins)\n\n\n### Third-party mixins\n\n* [asyngleton](/crcn/asyngleton.js) - asynchronous singletons\n* [step](/crcn/structr-step) \n \n\n\n### Installation\n\nNode.js: \n\n\tnpm install structr\n\t\t \n\t\t\n### .structr([...parents], classObject)\n\n\n```javascript\n\nvar EventEmitter = require(\"events\").EventEmitter,\nstructr = require(\"structr\");\n \n/**\n * create a mouse class which extends the node.js event emitter\n */\n\nvar Mouse = structr(EventEmitter, { \n\n\t/**\n\t */\n\n\t\"__construct\": function() {\n\t\tthis._super();\n\n\t\t//initial coords\n\t\tthis.move(0, 0);\n\t},\n\n\t/**\n\t * moves the mouse\n\t */\n\n\t\"move\": function(x, y) {\n\t\tthis.position({ x: x, y: y});\n\t},\n\n\t/**\n\t * second version of move incase an object is provided\n\t */\n\n\t\"second move\": function(position) {\n\t\tthis.position(position);\n\t},\n\n\t/**\n\t * getter / setter for the position\n\t */\n\n\t\"explicit position\": {\n\t\t\"get\": function() {\n\t\t\treturn this._position;\n\t\t},\n\t\t\"set\": function(value) {\n\t\t\tthis._position = value;\n\t\t\tthis.emit(\"move\");\n\t\t}\n\t} \n}); \n\nvar mouse = new Mouse();\n\n//listen for when the mouse has moved\nmouse.on(\"move\", function() {\n\tconsole.log(\"mouse moved!\");\n})\n\n//move 100 px left, and 100 px from the top\nmouse.move(100, 100);\n\n```\n\n\n### Class.extend(target, [...mixins]);\n\nExtends a class\n\n\n```javascript\n\nvar fs = require(\"fs\"),\nstructr = require(\"structr\"),\nmkdirp = require(\"mkdirp\"),\npath = require(\"path\");\n\n//mixin the singleton plugin\nstructr.mixin(require(\"asyngleton\"));\n\n/**\n * base cache interface\n */\n\nvar AbstractCache = structr({\n\t\n\t/**\n\t * returns a cached value\n\t */\n\n\t\"abstract get\": function(key, onGet) { },\n\n\t/**\n\t * sets a cached value\n\t */\n\n\t\"abstract set\": function(key, value, onSet) { }\n});\n\n/**\n * memory cache\n */\n\nvar MemoryCache = AbstractCache.extend({\n\t\n\t/**\n\t */\n\n\t\"__construct\": function() {\n\t\tthis._collection = {};\n\t},\n\n\t/**\n\t */\n\n\t\"get\": function(key, onGet) {\n\t\tonGet(null, this._collection[key]);\n\t},\n\n\t/**\n\t */\n\n\t\"set\": function(key, value, onSet) {\n\t\tthis._collection[key] = value;\n\t\tif(onSet) onSet(null, value);\n\t}\n});\n\n\n/**\n */\n\nvar FsCache = MemoryCache.extend({\n\t\t\n\t/**\n\t */\n\n\t\"override __construct\": function(path) {\n\t\tthis._path = path;\n\t\tthis._super();\n\t},\n\n\t/**\n\t */\n\n\t\"override set\": function() {\n\t\tthis._super.apply(this, arguments);\n\t\tthis._save();\n\t},\n\n\t/**\n\t */\n\n\t\"override get\": function(key, onKey) {\n\t\tvar _super = this._super;\n\n\t\t//load the fs cache before getting the value - this only happens ONCE \n\t\t//since _load is an asynchronous singleton.\n\t\tthis._load(function() {\n\t\t\t_super(key, onKey);\n\t\t});\n\t},\n\n\n\t/**\n\t * saves the collection to disc\n\t */\n\n\t\"_save\": function() {\n\t\tif(this._saving) return;\n\t\tthis._saving = true;\n\n\t\tvar self = this;\n\n\t\t//make the directory incase it doesn't exist. \n\t\tthis._mkdir(path.dirname(this._path), function() {\n\n\t\t\t//write the json file, with the json content\n\t\t\tfs.writeFile(self._path, JSON.parse(self._collection), function(err result) {\n\n\t\t\t\t//give some time before unlocking the save method. \n\t\t\t\t//We don't want to hit fs.write on each set\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tself._saving = false;\n\t\t\t\t}, 2000);\n\t\t\t});\n\t\t});\n\t},\n\n\t/**\n\t * loads the fs cache into memory\n\t */\n\n\t\"singleton _load\": function(onLoad) {\n\t\ttry {\n\t\t\tthis._collection = require(this._path);\n\t\t} catch(e) {\n\t\t\t//do nothing - the file doesn't exist\n\t\t}\n\t\tonLoad();\n\t},\n\n\t/**\n\t * makes the fs cache directory incase it's nested. Only happens ONCE on save.\n\t */\n\n\t\"singleton _mkdir\": function(onMkdir) {\n\t\tmkdirp(path.dirname(this._path), onMkdir);\n\t}\n});\n\n\nvar cache = new FsCache(__dirname + \"/test.json\");\n\n\ncache.get(\"name\", function(err, name) {\n\n\tif(name) {\n\t\treturn console.log(\"hello %s!\", name);\n\t}\n\n\tcache.set(\"name\", \"craig\", function() {\n\t\tconsole.log(\"saved!\");\n\t});\n});\n\n```\n\n### Modifiers \n \n### Overriding Methods\n\nMethods overridden have access to the _super property.\n\n```javascript\n\n\"override __construct\": function ()\n{\n\tthis._super();\n}\n\n```\n\n### Overwriting Methods\n \nFaster if you don't plan on using _super.\n\n\n```javascript\n\n\"__construct\": function ()\n{\n\t//cannot access _super __construct\n}\n\n```\n\t\n\t\n### Overloading Methods (Experimental)\n\nOverloading methods allows you to write methods which are mapped out depending on the number of parameters used. You must provide your own identifier (it could be anything) for each overloaded method, otherwise you'll simply be overwriting methods. For this example, I separate methods based on their order, e.g. `one`, `two`, `three`, etc.\n\n\n```javascript\n\nvar Person = Structr({\n\n\t\"sayHello\": function (name, callback)\n\t{\n\t\tthis._name = name;\n\t\tthis.sayHello(callback);\n\t},\n\n\t\"second sayHello\": function (callback)\n\t{\n\t\tcallback(this.sayHello());\n\t},\n\n\t\"third sayHello\": function ()\n\t{\n\t\treturn 'Hello ' + this._name;\n\t}\n});\n\nvar SubPerson = Person.extend({\n\n\t\"override sayHello\": function (callback)\n\t{\n\t\tcallback(this.sayHello() + \" Do you like italian food?\");\n\t},\n\n\t\"override second sayHello\": function ()\n\t{\n\t\treturn \"Hello \" + this._name + \", how are you doing today?\";\n\t}\n});\n\n\nvar p = new SubPerson();\np.sayHello(\"Craig\", function(message)\n{\n\talert(message); //Hello Craig. how are you doing today? Do you like italian food?\n});\n\n```\n\n### Static Keyword \n\nProperties, and methods set to the class versus objects instantiated.\n\n\n```javascript\n\nvar Singleton = Structr({\n\t\n\t\"static getInstance\": function ()\n\t{\n\t\treturn this._instance || (this._instance = new Singleton());\n\t}\n});\n\nvar test1 = Singleton.getInstance();\nvar test2 = Singleton.getInstance();\ntest2.name = 'Craig';\n\nconsole.log(test1.name); //Craig\n\n```\n\n### Getters & Setters \n\nBoth Implicit / Explicit methods are supported, however implicit getters & setters aren't supported in all browsers. Use implicit get/set if you're doing any development under a specific platform such as Node.js, or Appcelerator Titanium.\n\n\n\n```javascript\n\nvar GSTestClass = Structr({\n\n\t\"explicit explicitValue\": {\n\t\t\"get\": function ()\n\t\t{\n\t\t\treturn this._name;\n\t\t},\n\t\t\"set\": function (value)\n\t\t{\n\t\t\tthis._name = value;\n\t\t}\n\t},\n\t\n\t\"implicit implicitValue\": {\n\t\t\"get\": function ()\n\t\t{\n\t\t\treturn this._name;\n\t\t},\n\t\t\"set\": function (value)\n\t\t{\n\t\t\tthis._name = value;\n\t\t}\n\t},\n\t\n\t\"explicit explicitValue2\":true\n});\n\n\nvar test = new GSTestClass();\ntest.explicitValue('Craig'); \nconsole.log(test.explicitValue());\n\ntest.implicitValue = 'Tim';\nconsole.log(test.implicitValue);//Tim\nconsole.log(test.explicitValue());//Tim\n\ntest.explicitValue2('hello world');\nconsole.log(test.explicitValue2());//hello world\n\t\n```\n\nMetadata \n--------\n\nCustom modifiers are considered metadata. Use them to identify how specific methods should be handled.\n\n\n```javascript\n\n\nvar MetadataTestClass = Structr({\n\t\n\t\"myCustomMetadata test\": function ()\n\t{\n\t\treturn \"Hello Test\";\n\t}\n}));\n\n\nconsole.log(MetadataTestClass.prototype.test.myCustomMetadata); //true\n\n```\n\t\n\t\n###Bindable Metadata\n\nTo add. Makes a property bindable for change. Psuedocode:\n\n\n```javascript\n\nvar Person = Structr({\n\t\n\t\"__construct\": function(name)\n\t{\n\t\tthis.name(name);\n\t\t\n\t\tBindable.apply(this);\n\t},\n\t\n\t\"bindable explicit name\": 1\n});\n\n\nvar person1 = new Person(\"craig\");\n\n//listen for any change to name\nperson1.name.subscribe(function(newName)\n{\n\talert('Name changed to '+newName);\n});\n\n//on change the subscribers will be triggered\nperson1.name(\"Craig\");\n\n```\n\t\n###Setting Metadata\n\nTo add. Easy way to store settings on the user's computer. Psuedocode:\n\n\n```javascript\n\nvar User = Structr({\n\n\t\"__construct\": function ()\n\t{\n\t\tSettingManager.apply(this);\n\t},\n\t\n\t\"login\": function ()\n\t{\n\t\t\n\t\t//set the account info which will be saved as a cookie\n\t\tthis.accountInfo({ name: \"Craig\", last: \"Condon\", token: \"XXXXXXXXXX\" })\n\t},\n\t\n\t\"setting explicit accountInfo\": 1\n});\n\n\nvar u = new User();\n\n//this gets passed once\nif(!u.accountInfo)\n{\n\tu.login();\n}\nelse\n{\n\t//pulled from local computer\n\talert(u.accountInfo.name);\n}\n\n```\n\t\n\t\nTips:\n----\n\n\t\n* Wrap methods / properties in single, or double quotes. \n* Avoid the over-use of override, or overloaded methods.\n* Only use Structr where you would create prototyped classes.\n\n\nTo Do:\n------\n\n- change _super(...) to _super({ method: [args] }), or _super('method').call(...);\n\n\t\n\n\n",
"readmeFilename": "README.md",
- "_id": "structr@0.2.2",
+ "_id": "structr@0.2.3",
"_from": "structr@0.2.x"
}
View
23 node_modules/structr/project.sublime-project
@@ -1,23 +0,0 @@
-{
- "folders":
- [
- {
- "path": "."
- }
- ],
- "build_systems":
- [
- {
- "name":"cbd make",
- "cmd":["cbd","make","Structr"]
- },
- {
- "name":"cbd start",
- "cmd":["cbd","start","Structr"]
- },
- {
- "name":"cbd make+start",
- "cmd":["cbd","make+start","Structr"]
- }
- ]
-}
View
468 node_modules/structr/project.sublime-workspace
@@ -1,468 +0,0 @@
-{
- "auto_complete":
- {
- "selected_items":
- [
- ]
- },
- "buffers":
- [
- {
- "file": "lib/index.js",
- "settings":
- {
- "buffer_size": 13090,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin hKyk7M.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "file": "/tmp/subl stdin XDUtjV.txt",
- "settings":
- {
- "buffer_size": 0,
- "line_ending": "Unix"
- }
- },
- {
- "contents": "\n\n\nvar EventEmitter = Structr({\n\n /**\n */\n \n '__construct': function ()\n { \n this._listeners = {};\n },\n \n /**\n * listens to an event\n * @type The type of event to listen to\n * @callback The callback when the event type is emitted\n */\n \n 'on': function (type, callback)\n { \n (this._listeners[type] || (this._listeners[type] = [])).push(callback); \n \n var self = this;\n \n return {\n dispose: function ()\n { \n self.removeListener(type, callback);\n }\n }\n },\n \n /**\n * Removes an event listener\n */\n \n 'removeListener': function (type, callback)\n {\n var lists = this._listeners[type],i,\n self = this;\n if(!lists) return; \n if((i = lists.indexOf(callback)) > -1)\n {\n lists.splice(i,1);\n \n if(!lists.length)\n {\n delete self._listeners[type];\n }\n }\n },\n \n /**\n * emits an event\n */\n \n 'emit': function ()\n { \n var args = [],\n type = arguments[0],\n lists;\n \n for(var i = 1, n = arguments.length; i < n; i++)\n {\n args[i-1] = arguments[i];\n } \n \n \n if(lists = this._listeners[type]) \n for(var i = lists.length; i--;)\n { \n lists[i].apply(this, args);\n } \n }\n}); \n\n\n\n\n\nvar em = new EventEmitter();\n\nem.on('sayHello', function(value)\n{\n alert('Hello '+value);\n});\n\nem.on('sayHello', function(value)\n{\n alert('Hello '+value);\n});\n\nem.on('sayHello', function(value)\n{\n alert('Hello '+value);\n});\n\nem.on('sayHello', function(value)\n{\n alert('Hello '+value);\n});\n\n\nem.emit('sayHello', 'craig');",
- "file": "examples/events.js",
- "file_size": 1647,
- "file_write_time": 1329245889000000,
- "settings":
- {
- "buffer_size": 1649,
- "line_ending": "Unix"
- }
- },
- {
- "file": "examples/proto.js",
- "settings":
- {
- "buffer_size": 687,
- "line_ending": "Unix"
- }
- },
- {
- "file": "README.md",
- "settings":
- {
- "buffer_size": 9002,
- "line_ending": "Unix"
- }
- },
- {
- "file": "examples/overloading.js",
- "settings":
- {
- "buffer_size": 1485,
- "line_ending": "Unix"
- }
- }
- ],
- "build_system": "",
- "command_palette":
- {
- "height": 0.0,
- "selected_items":
- [
- ],
- "width": 0.0