Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor, getting rid of JSDocs, documentation lives better outside o…

…f src code, also making lots of changes for better usage inside a node.js environment
  • Loading branch information...
commit d887480cc3da8a7b96857f6e85c017f6bcf6ad3c 1 parent 1846f2c
Taka Kojima authored
Showing with 85 additions and 6,857 deletions.
  1. +4 −13 Makefile
  2. +2 −5 bin/minion-cli.js
  3. +3 −4 bin/minion.Interface.js
  4. +0 −1,456 bin/minion.js
  5. +2 −2 dist/minion-1.4.4.js
  6. +2 −2 dist/minion-1.4.4.min.js
  7. +2 −2 dist/minion-latest.js
  8. +2 −2 dist/minion-latest.min.js
  9. 0  { → docs}/getting_started.md
  10. 0  {bin → docs}/sample.conf.json
  11. +0 −1  gh-pages
  12. +5 −9 {src → lib}/minion.baseclass.js
  13. +4 −24 {src → lib}/minion.class.js
  14. +1 −1  {src → lib}/minion.header.js
  15. +16 −0 lib/minion.js
  16. +14 −80 {src → lib}/minion.main.js
  17. +12 −0 lib/minion.node.js
  18. +0 −20 {src → lib}/minion.notifications.js
  19. +1 −12 {src → lib}/minion.singleton.js
  20. +0 −6 {src → lib}/minion.static.js
  21. +1 −0  lib/version.txt
  22. +7 −5 package.json
  23. +7 −29 readme.md
  24. +0 −27 src/jsdoc-conf.json
  25. +0 −191 src/minion-jsdoc-template/README.md
  26. +0 −17 src/minion-jsdoc-template/allclasses.tmpl
  27. +0 −58 src/minion-jsdoc-template/allfiles.tmpl
  28. +0 −599 src/minion-jsdoc-template/class.tmpl
  29. +0 −647 src/minion-jsdoc-template/class.tmpl_old
  30. +0 −9 src/minion-jsdoc-template/docsindex.tmpl
  31. +0 −2  src/minion-jsdoc-template/header.html
  32. +0 −65 src/minion-jsdoc-template/index.tmpl
  33. +0 −310 src/minion-jsdoc-template/js/htmlparser.js
  34. +0 −508 src/minion-jsdoc-template/js/jsdom.js
  35. +0 −1,092 src/minion-jsdoc-template/js/mootools-1.2.4-core-server.js
  36. +0 −419 src/minion-jsdoc-template/js/showdown.js
  37. +0 −34 src/minion-jsdoc-template/js/showdown_license.txt
  38. +0 −533 src/minion-jsdoc-template/publish.js
  39. +0 −247 src/minion-jsdoc-template/static/blue.css
  40. +0 −266 src/minion-jsdoc-template/static/default.css
  41. +0 −35 src/minion-jsdoc-template/symbol.tmpl
  42. +0 −90 src/minion-jsdoc-template/symbolindex.tmpl
  43. +0 −35 src/minion-jsdoc-template/userdoc.tmpl
View
17 Makefile
@@ -2,7 +2,7 @@
OVERRIDING=default
-SRC_DIR = src
+SRC_DIR = lib
TEST_DIR = test
PREFIX = .
@@ -39,7 +39,7 @@ b=0
all: core node
-core: min docs
+core: min
@@echo "minion build complete."
minion:
@@ -53,30 +53,21 @@ minion:
sed 's/@VERSION/'"${VER}"'/' > ${minion};
@@cp ${minion} ${minion_LATEST}
- @@cp ${minion} ${PREFIX}/bin/minion.js;
min: minion
@@${COMPILER} ${minion} > ${minion_MIN}
@@cat ${HEADER} ${minion_MIN} | \
sed 's/@DATE/'"${DATE}"'/' | \
- sed 's/@VERSION/'"${VER}"'/' > bin/tmp
+ sed 's/@VERSION/'"${VER}"'/' > tmp
- @@mv bin/tmp ${minion_MIN}
+ @@mv tmp ${minion_MIN}
@@cp ${minion_MIN} ${minion_LATEST_MIN}
-docs: minion
- node_modules/jsdoc-toolkit/app/run.js -c=${SRC_DIR}/jsdoc-conf.json
-
size: minion min
@@gzip -c ${minion_MIN} > ${minion_MIN}.gz; \
wc -c ${minion} ${minion_MIN} ${minion_MIN}.gz;
@@rm ${minion_MIN}.gz; \
-push_docs: docs
- cd gh-pages; git add .; \
- git commit -am "updated docs"; \
- git push origin gh-pages
-
node:
@@node make.js
View
7 bin/minion-cli.js
@@ -1,12 +1,9 @@
#!/usr/bin/env node
-
-minion = require("./minion.js");
-
var argv = require('optimist').argv;
-
var method = argv._[0];
+var minion = require("../lib/minion.js");
-minion.provides("./minion.Interface.js", "minion.Interface");
+require("./minion.Interface.js");
minion.require("minion.Interface", function(Interface) {
View
7 bin/minion.Interface.js
@@ -1,4 +1,3 @@
-minion = require('./minion.js');
var fs = require("fs");
var color = require("ansi-color").set;
var jshint = require("jshint").JSHINT;
@@ -397,14 +396,14 @@ minion.define("minion", {
this.build();
}
}));
- }
+ }
},
// Cleans up any watchers on this._filesToWatch files.
- _unwatchFiles : function(){
+ _unwatchFiles : function() {
for(var i = 0; i < this._filesToWatch.length; i ++) {
var file = this._filesToWatch[i];
fs.unwatchFile(file);
- }
+ }
}
})
View
1,456 bin/minion.js
@@ -1,1456 +0,0 @@
-/*
- * minion.JS v1.4.4
- * http://minion.org
- *
- * (c) 2011, Taka Kojima
- * Licensed under the MIT License
- *
- * Date: Sat Jan 21 23:51:10 2012 -0800
- */
- /**
-
-@fileOverview
-
-<h4>MinionJS - Cross-Platform & Cross-Browser JavaScript Inheritance</h4>
-
-<p>Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:</p>
-
-<p>The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.</p>
-
-<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.</p>
-*/
-
-
-/**
-* Global MinionJS Object with Static methods.
-*
-* @namespace
-*/
-
-/*
- TODO:
- - Multiple inheritance
- - Independent library support, i.e. ability to do minion.require("minion.libs.jquery") to load jquery
- - __preDefine method on Classes, takes 1 argument, a callback that gets called once __preDefine does all it needs to do
-*/
-
-var minion = (function (root) {
-
- "use strict";
-
- // If Array.indexOf is not defined, let's define it.
- Array.prototype.indexOf = Array.prototype.indexOf || function (a, b) {
- if (!this.length || !(this instanceof Array) || arguments.length < 1) {
- return -1;
- }
-
- b = b || 0;
-
- if (b >= this.length) {
- return -1;
- }
-
- while (b < this.length) {
- if (this[b] === a) {
- return b;
- }
- b += 1;
- }
- return -1;
- };
-
- var _classMappings = [];
- var _aliases = ["minion"];
-
- var _separator = ".";
- var _class_path = "";
- var _file_suffix = "";
-
- var _initialized;
-
- var _loadQueue = [];
- var _extendQueue = [];
-
- var _waitID;
- var _waitingForLoad = [];
- var _loadedFiles = [];
- var _notificationManager;
- var _waitInterval = 500;
-
- var _isNode = (typeof window === "undefined");
-
- var _root = root;
- var _ns = {};
- var _errorTimeout = 1e4;
-
- /**
- * @exports _minion as minion
- * @class
- */
- var _minion = {};
-
- /*================= HELPER FUNCTIONS =================*/
-
- /** @private */
- var _isArray = Array._isArray || function (a) {
- return a instanceof Array;
- };
-
- /** @private */
- var _isObject = function (obj) {
- return typeof obj === "object";
- };
-
- /** @private */
- var _isString = function (s) {
- return typeof s === 'string' || s instanceof String;
- };
-
- /** @private */
- var _isFunction = function (fn) {
- return typeof fn === "function";
- };
-
- /** @private */
- var _strToArray = function (s) {
- return (!_isArray(s)) ? [s] : s;
- };
-
- /** @private */
- var _concatArray = function (a, b, forceUnique) {
- b = b || [];
- if(!forceUnique){
- return a || [].concat(b);
- }
-
- // Force unique values
- b = [].concat(b);
- a = a || [];
-
- for(var i = 0, l = a.length; i < l; i += 1){
- if(b.indexOf(a[i]) < 0){
- b[b.length] = a[i];
- }
- }
-
- return b;
- };
-
- /** @private */
- var _copyToNS = function(o1,o2){
- for (var i in o1) {
- if(o1.hasOwnProperty(i)){
- o2[i] = o1[i];
- }
- }
- };
-
- /** @private */
- var _removeFromNS = function(o1,o2){
- for (var i in o1) {
- if(o1.hasOwnProperty(i)){
- o2[i] = null;
- delete o2[i];
- }
- }
- };
-
-
- // Recursively checks dependencies
- /** @private */
- var _areDependenciesLoaded = function (o) {
- o = _minion.get(o, false);
- var i;
-
- if (!o.__isDefined) {
- return false;
- }
- if (o.__dependencies) {
- for (i = 0; i < o.__dependencies.length; i += 1) {
- if (!_areDependenciesLoaded(o.__dependencies[i])) {
- return false;
- }
- }
- }
- return true;
- };
-
- /** @private */
- var _checkLoadQueue = function () {
- var i, j, q, dependenciesLoaded, classes, classesArray;
- q = {};
- classes = {};
- classesArray = [];
-
- for (i = _loadQueue.length - 1; i >= 0; i --) {
-
- q = _loadQueue[i];
- dependenciesLoaded = true;
-
- for (j = 0; j < q.c.length; j ++) {
- dependenciesLoaded = _areDependenciesLoaded(q.c[j]);
- if (!dependenciesLoaded) {
- break;
- }
- }
-
- if (dependenciesLoaded) {
- if (q.cb) {
- q.cb.apply(_root, _minion.get(q.c));
- }
- _loadQueue.splice(i, 1);
- }
- }
- };
-
- /** @private */
- var _checkExtendQueue = function () {
- var eq = _extendQueue;
- var i, superClass, ns, id;
-
- for (i = eq.length - 1; i >= 0; i --) {
-
- ns = eq[i].split(_separator);
- id = ns.splice(ns.length - 1, 1)[0];
- ns = _minion.get(ns.join(_separator), false);
-
- if (ns[id].__toExtend) {
- superClass = _minion.get(ns[id].__extendedFrom, false);
- if (superClass.__isDefined) {
-
- ns[id].__toExtend = false;
- delete ns[id].__toExtend;
-
- ns[id] = _minion.extend(ns[id].__extendedFrom, ns[id]);
-
- eq.splice(i, 1);
- setTimeout(_checkExtendQueue, 0);
- return;
- }
- }
- }
- _checkLoadQueue();
- };
-
- /** @private */
- var _checkWaitQueue = function () {
-
- var w = _waitingForLoad;
- var i, o;
-
- if (_waitID) {
- clearTimeout(_waitID);
- }
-
- for (i = 0; i < w.length; i += 1) {
- o = w[i];
- o.e += 50;
-
- if (_minion.isDefined(o.c)) {
- o.s.onload();
- }
-
- else if (o.e >= _errorTimeout) {
- o.s.onerror();
- }
- }
-
- if (w.length > 0) {
- _waitID = setTimeout(_checkWaitQueue, _waitInterval);
- }
- };
-
- /**
- * Injects a Script tag into the DOM
- *
- * @param f The path of the file to inject.
- * @param c The class which maps to the file we are injecting.
- * @private
- */
-
- var _inject = function(f, c) {
-
- var doc = document;
- var body = "body";
-
- var injectObj, script;
-
- if (!doc[body]) {
- return setTimeout(function(){
- _inject(f,c);
- }, 0);
- }
-
- script = doc.createElement("script");
- script.async = true;
-
- injectObj = {
- f : f, // File
- c : c, // Class
- e : 0, // Elapsed Time
- s : script // Script
- };
-
- _waitingForLoad.push(injectObj);
-
- /** @ignore */
- script.onreadystatechange = /** @ignore */ script.onload = function (e) {
- if (_minion.isDefined(c)) {
- injectObj.s.onload = injectObj.s.onreadystatechange = null;
- injectObj.s.onerror = null;
- _waitingForLoad.splice(_waitingForLoad.indexOf(injectObj), 1);
- }
- };
-
- /** @ignore */
- script.onerror = function (e) {
- injectObj.s.onerror = null;
- _waitingForLoad.splice(_waitingForLoad.indexOf(injectObj), 1);
- throw new Error(injectObj.c + " failed to load. Attempted to load from file: " + injectObj.f);
- };
-
- script.src = f;
-
- // Append the script to the document body
- doc[body].appendChild(script);
- };
-
- /**
- * Does all the loading of JS files
- *
- * @param q The queue to be loaded
- * @private
- */
-
- var _load = function (q) {
-
- _loadQueue.push(q);
-
- for (var i = 0; i < q.f.length; i += 1) {
-
- if(_isNode){
- require(q.f[i]);
- }
- else{
- _inject(q.f[i], q.c[i]);
- }
- }
-
- /*
- If the load times out, fire onerror after the time defined by _errorTimeout (default is 10 seconds)
- (can be changed through minion.config({minion.errorTimeout : ms});
- */
- _waitID = setTimeout(_checkWaitQueue, _waitInterval);
- };
-
- /**
- * Used by minion.get() and minion.define().
- * Get the namespace/Class, or creates it if it does not exist. Also optionally creates Objects in the specified namepsace.
- *
- * @param {String|Object}id The fully qualified namespace.
- * @param {Boolean} autoCreate Whether or not to create a blank object if the namespace does not yet exist.
- * @param {Object} [definitions] An object of class definitions which will be added to the namespace.
- * @returns {Object} The object that represents the fully qualified namespace passed in as the first argument.
- * @private
- */
-
- var _namespace = function (id, autoCreate, definitions) {
- id = id || "";
- definitions = definitions || false;
-
- var ns = _ns;
- var i;
-
- if (id && !_isObject(id) && !_isFunction(id)) {
- var parts = id.split(_separator);
-
- if (_aliases.indexOf(parts[0]) > -1) {
- ns = _minion;
- parts.splice(0,1);
- }
-
- for (i = 0; i < parts.length; i += 1) {
- if (!ns[parts[i]]) {
- if (autoCreate) {
- ns[parts[i]] = {};
- }
- else{
- return false;
- }
- }
- ns = ns[parts[i]];
- }
- }
-
- else if (id !== "") {
- ns = id;
- }
- else{
- return false;
- }
-
- if (definitions) {
-
- definitions.require = _concatArray(definitions.require);
- var cr = definitions.require;
-
- for (var className in definitions) {
-
- if (className !== "require") {
-
- var qualifiedName = id + _separator + className;
- var c = definitions[className];
-
- if (c.__extendedFrom) {
- cr.push(c.__extendedFrom);
- }
-
- if (c.__toExtend) {
- if (_extendQueue.indexOf(qualifiedName) < 0) {
- _extendQueue.push(qualifiedName);
- }
- }
-
- c.__static = c.__static || {};
-
- c.__nsID = id;
- c.__ns = ns;
- c.__class = className;
-
- if (cr.length > 0) {
- c.__dependencies = _concatArray(c.__dependencies, cr, true);
- _minion.require(cr);
- }
-
- if (_minion.isDefined(c) && c.prototype) {
- var proto = c.prototype;
- proto.__nsID = id;
- proto.__ns = ns;
- proto.__class = className;
-
- if (cr.length > 0) {
- proto.__dependencies = _concatArray(proto.__dependencies, cr, true);
- }
- }
-
- ns[className] = c;
- }
- }
- }
-
- return ns;
- };
-
- /*================= END OF HELPER FUNCTIONS =================*/
-
-
- /**
- * Configure minion.
- *
- * @public
- * @param {Object} configObj Configuration object, possible properties are : classPath, separator and fileSuffix
- */
-
- _minion.configure = function (configObj) {
-
- configObj = configObj || {};
-
- _class_path = configObj.classPath || _class_path;
- _class_path = (_class_path.lastIndexOf("/") === _class_path.length - 1) ? _class_path : _class_path + "/";
-
- _separator = configObj.separator || _separator;
- _file_suffix = configObj.fileSuffix || _file_suffix;
-
- if(configObj.paths){
- for(var i = 0; i < configObj.paths.length; i ++){
- var m = configObj.paths[i];
- _minion.provides(m.file, m.classes);
- }
- }
-
- _initialized = true;
- };
-
- /**
- * Alias minion under a different namespace. I.e. var woot = minion.alias("woot");
- *
- * @public
- * @param {String} alias The name of the namespace to alias minion under.
- */
-
- _minion.alias = function (alias) {
- _aliases.push(alias);
- return _minion;
- };
-
- /**
- * Gets the object by it's fully qualified identifier.
- *
- * @public
- * @param {String} id The identifier to get
- * @returns {Object|Boolean} The object that represents the identifier or false if it has not yet been defined.
- */
-
- _minion.get = function (id) {
- if(!_isArray(id)){
- return _namespace(id, false);
- }
- else{
- var classes = _minion.use(id, {});
- var classesArray = [];
-
- for (var c in classes) {
- if(classes.hasOwnProperty(c)) {
- classesArray.push(classes[c]);
- }
- }
-
- return classesArray;
- }
- };
-
- /**
- * Defines Classes under the given namespace.
- *
- * @public
- * @param {String} id The namespace to define the Classes under.
- * @param {Object} [definitions] An object of class definitions which will be added to the namespace
- * @returns {Object} The object that represents the namespace passed in as the first argument.
- */
- _minion.define = function (id, definitions) {
- var r = _namespace(id, true, definitions);
- _checkExtendQueue();
- return r;
- };
-
- /**
- * Gets the URL for a given identifier.
- *
- * @public
- * @param {String} id The fully qualified name to look up.
- * @returns {String} The URL of the file that maps to the fully qualified name.
- */
-
- _minion.getURL = function (id) {
-
- if (_classMappings[id]) {
- return _classMappings[id];
- }
-
- var isDir = id.indexOf("*") > -1;
- id = isDir ? id.replace(".*", "") : id;
- var url = _class_path + id.replace(new RegExp('\\' + _separator, 'g'), '/') + (isDir ? "" : '.js') + ((_file_suffix) ? "?" + _file_suffix : "");
-
- return url;
- };
-
- /**
- * Checks to see whether the given fully qualified name or Object is defined as a minion class. (Checks for .__isDefined)<br>
- * NOTE: Classes that have not yet loaded all of their dependencies, will return FALSE for this check.
- *
- * @public
- * @param {String|Object} id The fully qualfied class name, or an Object.
- * @returns {Boolean} Whether or not this is defined.
- */
-
- _minion.isDefined = function (id) {
- id = (!_isObject(id) && !_isFunction(id)) ? _namespace(id, false) : id;
- return (id) ? id.__isDefined : false;
- };
-
- /**
- * Extends a given class asynchronously.
- *
- * @public
- * @param {String} id The fully qualified name of the Class you want to extend.
- * @param {Object} obj A new Class Object
- * @returns {Object} The extended Class, or, if still waiting on dependencies, the original Object with a few more properties for internal minion use.
- */
-
- _minion.extend = function (id, obj) {
-
- // If the Class exists and is a minion class, then return the extended object.
- if (_minion.isDefined(id)) {
- obj = _minion.get(id).__extend(obj);
- }
- else{
- obj.__toExtend = true;
- }
-
- obj.__extendedFrom = id;
-
- return obj;
- };
-
- /**
- * Tells minion that filePath provides the class definitions for these classes.
- * Useful in cases where you group specific things into minfiied js files.
- *
- * @public
- * @param {String} file The path of a JS file.
- * @param {String|Array} definitions Fully qualfiied name(s) of class(es)
- */
-
- _minion.provides = function (file, definitions) {
-
- // If classes is a String, create an array
- definitions = _strToArray(definitions);
-
- // If the file is not absolute, prepend the _class_path
- //file = (!new RegExp("(http://|/)[^ :]+").test(file)) ? _class_path + file : file;
-
- for (var i = 0; i < definitions.length; i += 1) {
- _classMappings[definitions[i]] = file;
- }
- };
-
- /**
- * Asyncrhonously loads in js files for the classes specified.
- * If the classes have already been loaded, or are already defined, the callback function is invoked immediately.
- *
- * @public
- * @param {String|Array} ids The fully qualified name(s) of the class(es) to load.
- * @param {Function} callback The function to call once all classes (and their dependencies) have been loaded.
- */
-
- _minion.require = function (ids, callback) {
- if (!_initialized) {
- _minion.configure();
- }
-
- ids = _strToArray(ids);
-
- var fileList = [];
- var classList = [];
-
- for (var i = 0; i < ids.length; i ++) {
-
- var id = ids[i];
- var file = _minion.getURL(id);
- var get = _minion.get(id);
-
- classList.push(id);
-
- if ((_loadedFiles.indexOf(file) < 0) && !_minion.get(id)) {
- fileList.push(file);
- _loadedFiles.push(file);
- }
- }
-
- if (fileList.length > 0) {
-
- var q = {
- f : fileList,
- c : classList,
- cb : callback
- };
-
- //_load(q);
- setTimeout(function(){_load(q);}, 0);
- }
-
- else if (callback) {
- callback.apply(_root, _minion.get(ids));
- }
- };
-
- /**
- * Copies an array of classes (by their fully qualified names) to the specified object/scope.
- *
- * By calling minion.use("test.Example", obj), you will be able to refer to test.Example as just obj.Example.
- *
- * Identifiers can contain the* wildcard character as its last segment (eg: test.*)
- * which will import all Classes under the given namespace.
- *
- * @public
- * @param {String|Array} ids The fully qualfiied name(s) to import into the global namespace.
- * @param {Object=[root]} The scope to use.
- * @returns {Object} Returns the object passed in as the second argument, with the classes passed in as the first argument as properties.
- */
-
- _minion.use = function (ids, scope) {
-
- ids = ids || [];
- ids = _strToArray(ids);
- scope = scope || _ns;
-
- if (scope === _ns) {
- _minion.unuse();
- }
-
- var i, id, obj, ns, n;
-
- for (i = 0; i < ids.length; i += 1) {
-
- id = ids[i];
-
- obj = _minion.get(id, true);
- ns = id.split(_separator);
- id = ns.splice(ns.length - 1, 1)[0];
- ns = _minion.get(ns.join(_separator), false);
-
- if (id === '*') {
- // injects all ids under namespace into the root namespace
- for (n in ns) {
- if(ns.hasOwnProperty(n)){
- scope[n] = ns[n];
- }
- }
- }
- else{
- // injects this id into the root namespace
- if (ns[id]) {
- scope[id] = ns[id];
- }
- }
- }
-
- return scope;
- };
-
- /** @private */
- _minion.enableNotifications = function () {
- if (_minion.isDefined("minion.NotificationManager")) {
- if (!_notificationManager) {
- _notificationManager = new (minion.get("minion.NotificationManager"))();
-
- /** @private */
- _minion.subscribe = function () {
- _notificationManager.subscribe.apply(_notificationManager, arguments);
- };
-
- /** @private */
- _minion.unsubscribe = function () {
- _notificationManager.unsubscribe.apply(_notificationManager, arguments);
- };
-
- /** @private */
- _minion.publish = function () {
- _notificationManager.publish.apply(_notificationManager, arguments);
- };
-
- /** @private */
- _minion.holdNotification = function () {
- _notificationManager.holdNotification.apply(_notificationManager, arguments);
- };
-
- /** @private */
- _minion.releaseNotification = function () {
- _notificationManager.releaseNotification.apply(_notificationManager, arguments);
- };
-
- /** @private */
- _minion.cancelNotification = function () {
- _notificationManager.cancelNotification.apply(_notificationManager, arguments);
- };
- }
- }
- };
-
- /*
- Define minion as an AMD module, if define is defined (and has .amd as a property)
- */
- if (typeof _root.define === "function" && _root.define.amd) {
- _root.define([], function () {
- return _minion;
- });
- }
-
- // Export for node
- if (_isNode){
- module.exports = _minion;
- }
-
- return _minion;
-
-})(this);(function(){
-
- "use strict";
-
- //* @ignore */
- minion.define("minion", {
-
- /**
- * The minion Base Class
- * Classical JavaScript Inheritance (or an attempt thereof)
- * minion.Class is the ONLY Class to extend this directly, do not directly extend this Class.
- * Largely taken from: http://ejohn.org/blog/simple-javascript-inheritance/
- * @ignore */
-
- __BaseClass__ : (function() {
-
- /*
- Attempts to shallow copy objects, so as to not have a bunch of references lying around in object instances
- Otherwise, it is bad news bears doing something like this.nArray.push() in a Class method
- because it modifies nArray on prototype, and thus any other instances of said Class
- */
- var _copy = function (obj) {
- var i, attr, c;
-
- // Null, undefined, number, boolean, string, function all get returned immediately, no need to copy them.
- if (!obj || typeof obj !== "object") {
- return obj;
- }
-
- if (obj instanceof Date) {
- return new Date().setTime(obj.getTime());
- }
-
- if (obj instanceof Array) {
- return obj.concat();
- }
-
- if (typeof obj === "object") {
- c = {};
- for (attr in obj) {
- if (obj.hasOwnProperty(attr)) {
- c[attr] = obj[attr];
- }
- }
- return c;
- }
- // If it fails, just return the original object.
- return obj;
- };
-
- var _createSuperFunction = function (fn, superFn) {
- return function() {
- var tmp = this.__super || null;
-
- // Reference the prototypes method, as super temporarily
- this.__super = superFn;
-
- var ret = fn.apply(this, arguments);
-
- // Reset this.__super
- if(tmp){this.__super = tmp;}
- else{this.__super = null; delete this.__super;}
- return ret;
- };
- };
-
- // Checks the function contents to see if it has a reference to __super
- var _doesCallSuper = /xyz/.test(function(){var xyz;}) ? /\b__super\b/ : /.*/;
-
- /** @ignore */
- var _baseClass = function(){};
-
- _baseClass.__isDefined = true;
-
- /** @ignore */
- _baseClass.__extend = function(obj) {
-
- // By passing "__no_init__" as the first argument, we skip calling the constructor and other initialization;
- var This = this;
- var _proto = new This("__no_init__");
- var _perInstanceProps = {};
- var _this = this;
-
- // Copy the object's properties onto the prototype
- for(var name in obj) {
-
- if(obj.hasOwnProperty(name)) {
-
- if(name !== "__static"){
- // If we're overwriting an existing function that calls this.__super, do a little super magic.
- if(typeof obj[name] === "function" && typeof _proto[name] === "function" && _doesCallSuper.test(obj[name])){
- _proto[name] = _createSuperFunction(obj[name], _proto[name]);
- }
- else{
- _proto[name] = obj[name];
- }
- }
-
- /*
- If it's an array or an object, we need to make a per instance copy of these values, so as to not affect other
- instances when dealing with Arrays or Objects.
- */
- else if (typeof obj[name] === "object" && name.indexOf("__") !== 0) {
- _perInstanceProps[name] = obj[name];
- }
- }
- }
-
- var _class = function() {
-
- if(arguments[0] !== "__no_init__"){
-
- /*
- Handy for referencing dependencies. If a Class requires example.Test, then you can reference said class
- in any method by this.__imports.Test;
-
- This method is preferred over this.use_dependencies(), as you have to explicitly call this.unuse_dependencies()
- to be responsible, at the end of every method.
- */
- if(!_class.prototype.hasOwnProperty("__imports")){
- _class.prototype.__imports = minion.use(this.__dependencies, {});
- }
-
- if(!this.__preInit){
-
- for (var attr in _perInstanceProps) {
- if (_perInstanceProps.hasOwnProperty(attr)) {
- this[attr] = _copy(_perInstanceProps[attr]);
- }
- }
-
- // All real construction is actually done in the init method
- return this.init.apply(this, arguments);
- }
-
- else{
- return this.__preInit.apply(this, arguments);
- }
-
- }
- };
-
- // Set the prototype and Constructor accordingly.
- _class.prototype = _proto;
- //* @ignore */
- _class.prototype.constructor = _class;
-
- // Expose the extend method
- //* @ignore */
- _class.__extend = _baseClass.__extend;
-
- _class.prototype.__extend = (function(scope, fn){
- return function(){
- return fn.apply(scope, arguments);
- };
- })(_class, _class.__extend);
-
- /*
- Custom minion properties, anything beginning with an __ on a Class or instance, is populated and used by minion.
- The "__" prefix is used to avoid naming conflictions with developers, and allows
- us to not have to impose a list of reserved words on developers.
- */
-
- _class.__ns = obj.__ns || "";
- _class.__nsID = obj.__nsID || "";
- _class.__class = obj.__class || "";
- _class.__dependencies = obj.__dependencies || [];
-
- /*
- Add all static methods and properties that are defined in the __static object.
- Only write to it if it doesn't already exist, to disable overwriting things we actually need for minion by malicious or
- plain bad code.
- */
- var prop;
-
- if(obj.__static){
- _class.__static = _class.__static || {};
- for(prop in obj.__static){
- if(!_class[prop]){
- _class[prop] = obj.__static[prop];
- _class.__static[prop] = obj.__static[prop];
- }
- }
- _class.__static = obj.__static;
- }
-
- if(this.__static){
- _class.__static = _class.__static || {};
- for(prop in this.__static){
- if(!_class[prop]){
- _class[prop] = this.__static[prop];
- _class.__static[prop] = this.__static[prop];
- }
- }
- }
-
- if(_class.__static.__isStatic){
-
- var StaticClass = _class;
- var s = new StaticClass();
-
- s.__static = _class.__static;
-
- for(prop in _class.__static){
- s[prop] = _class.__static[prop];
- }
-
- return s;
- }
-
- return _class;
- };
-
- return _baseClass;
-
- })()
- });
-
-})();(function(){
-
- "use strict";
-
- minion.define("minion", {
-
- /** @lends minion.Class# */
-
- Class : minion.extend("minion.__BaseClass__", {
-
- __static : {
- __isDefined: true
- },
-
- /**
- *
- * The base minion Class. All Classes are required to be descendants
- * of this class, either directly, or indirectly.
- *
- * @constructs
- */
- init: function(){
- if(!this._interestHandlers){
- this._interestHandlers = [];
- }
- },
-
- /**
- * Local version of window.setTimeout that keeps scope of <i>this</i>.<br>
- *
- * @returns {Number} A timeout ID
- */
- setTimeout : function(func, delay){
- return setTimeout(this.proxy(func), delay);
- },
-
- /**
- * Local version of window.setInterval that keeps scope of <i>this</i>.<br>
- *
- * @returns {Number} An interval ID
- */
- setInterval : function(func, delay){
- return setInterval(this.proxy(func), delay);
- },
-
- /**
- * Shorthand for <i>func.bind(this)</i><br>
- * or rather, <i>$.proxy(func, this)</i> in jQuery terms
- *
- * @returns {Function} The proxied function
- */
- proxy : function(func){
- var bind = function (context) {
- if (!context) {return this;}
- var this_ = this;
- return function() {
- return this_.apply(context, Array.prototype.slice.call(arguments));
- };
- };
-
- return bind.call(func, this);
- },
-
- /**
- * Subscribes to a notification.
- *
- * @public
- * @param {String} name The name of the Notification you are subscribing to.
- * @param {Function} handler A function to be called upon receiving the given Notification.
- */
-
- subscribe : function(name, handler, priority){
- if(!this._interestHandlers){
- this._interestHandlers = [];
- }
- if(handler && !this._interestHandlers[name]){
- minion.subscribe(this, name, priority);
- this._interestHandlers[name] = handler;
- }
- },
-
- /**
- * Unsubscribes from a notification.
- *
- * @public
- * @param {String} name The name of the Notification you are unsubscribing from.
- */
-
- unsubscribe : function(name){
- if(this._interestHandlers && this._interestHandlers[name]){
- this._interestHandlers[name] = null;
- delete this._interestHandlers[name];
- }
- minion.unsubscribe(this, name);
- },
-
- /**
- * Unsubscribes from all notifications registered via this.subscribe();
- */
-
- unsubscribeAll : function(){
- for(var interest in this._interestHandlers){
- if(this._interestHandlers.hasOwnProperty(interest)){
- this.unsubscribe(interest);
- }
- }
- this._interestHandlers = [];
- },
-
- /**
- * Publishes a notification with the specified data.
- *
- * @param {String} name The name of the Notification you are publishing.
- * @param {Object} data An object of data you want to send with the Notification.
- * @param {Function} callback A callback function to be invoked if Notification.respond() is called
- */
-
- publish : function(name, data, callback){
- minion.publish(name, data, this, callback);
- },
-
- /** @ignore */
- handleNotification : function(n){
- var handler = this._interestHandlers[n.name];
- if(handler){
- this.proxy(handler)(n);
- }
- }
-
- })
- });
-
-})(); (function(){
-
- "use strict";
-
- minion.define("minion", {
-
- /** @lends minion.Singleton# */
-
- Singleton : minion.extend("minion.Class", {
-
- /**
- *
- * A way to easily implement Singletons.
- *
- * @constructs
- * @extends minion.Class
- */
- init : function(){
-
- },
-
- /** @ignore */
- __preInit : function(){
- if(this.constructor.__instance){
- return this.constructor.__instance;
- }
-
- this.init.apply(this, arguments);
-
- this.constructor.__instance = this;
- return this.constructor.__instance;
- },
-
- /** @ignore */
- __static : {
-
- /** @lends minion.Singleton# */
- __isSingleton: true,
-
- /**
- *
- * Returns the instance of this Singleton. If this Class has not yet been instantiated, creates a new instance and returns that.
- * Otherwise, it returns the already existing reference.
- *
- * @memberOf minion.Singleton#
- */
- getInstance : function(){
- if(!this.__instance){
- var This = this;
- this.__instance = new This();
- return this.__instance;
- }
- return this.__instance;
- }
- }
-
- })
- });
-
-})();(function(){
-
- "use strict";
-
- minion.define("minion", {
-
- /** @lends minion.Static# */
-
- Static : minion.extend("minion.Singleton", {
-
- __static : {
- __isDefined : true,
- __isStatic : true
-
- },
-
- /**
- *
- * A way to easily implement Static Classes.
- *
- * @constructs
- * @extends minion.Singleton
- */
- init : function(){
-
- }
-
- })
- });
-
-})();(function(){
-
- "use strict";
-
- minion.define("minion", {
-
- /** @lends minion.Notification# */
-
- Notification : minion.extend("minion.Class", {
-
- data : {},
- name : "",
- dispatcher : null,
- status : 0, // 0 : Closed; 1 : Pending; 2 : Hold
- pointer : 0,
- callback : null,
-
- /**
- *
- * Notifications are the backbone of Minion's pub/sub model.
- * You should not have to construct Notification's directly, as the publish() method does this for you.
- *
- * @constructs
- * @param {String} name The name of the Notification.
- * @param {Object} data An object of data associated with the Notification.
- * @param {Function} callback A callback function. This gets invoked by calling Notification.respond();
- */
- init : function(name, data, callback) {
- this.name = name;
- this.data = data;
- this.callback = callback;
- },
-
- /**
- *
- * Holds a notification. Useful if you want to do other things before other instances receive this Notification,
- *
- * @public
- */
- hold : function() {
- this.status = 2;
- },
-
- /**
- *
- * Releases a Notification, call this at some point after hold();
- *
- * @public
- */
-
- release : function() {
- this.status = 1;
- minion.releaseNotification(this);
- },
-
- /**
- *
- * Cancels a Notification, any instances interested in this Notification higher up the chain will not receive it.
- *
- * @public
- */
-
- cancel : function() {
- minion.cancelNotification(this);
-
- this.data = {};
- this.name = "";
- this.status = 0;
- this.pointer = 0;
- this.dispatcher = null;
- this.callback = null;
- },
-
- /**
- *
- * Dispatches a Notification. You will rarely ever construct or call dispatch() on Notifications directly, as the publish() method handles all of this.
- *
- * @param {Object} obj An Object referencing what is dispatching this Notification.
- * @public
- */
-
- dispatch : function(obj) {
- this.status = 1;
- this.pointer = 0;
- this.dispatcher = obj;
-
- minion.publish(this);
- },
-
- /**
- *
- * Responds to a Notification. Pretty much just calls the callback function that is passed when constructing a new function.
- *
- * @public
- */
-
- respond : function () {
- if(this.callback) {
- this.callback.apply(typeof this.dispatcher == "object" ? this.dispatcher : this, arguments);
- this.callback = null;
- this.cancel();
- }
- }
- })
- });
-
-
- minion.define("minion", {
-
- /*
- This Class handles all the nitty gritty Notification stuff.
- TODO: Be nice and add some comments for other people :)
- */
-
- require : [
- "minion.Notification"
- ],
-
- NotificationManager : minion.extend("minion.Singleton", {
-
- _pendingNotifications: [],
- _pendingNotificationNames : [],
- _interests: {},
- _removeQueue: [],
-
- subscribe : function(obj, name, priority) {
-
- priority = isNaN(priority) ? -1 : priority;
- this._interests[name] = this._interests[name] || [];
-
- if(priority <= -1 || priority >= this._interests[name].length){
- this._interests[name].push(obj);
- }
- else{
- this._interests[name].splice(priority, 0, obj);
- }
- },
-
- unsubscribe : function(obj, name){
- if(name instanceof Array){
- for(var i = 0; i < name.length; i ++){
- this.unsubscribe(obj, name[i]);
- }
- return;
- }
- var objIndex = this._interests[name].indexOf(obj);
- if(obj && objIndex > -1){
-
- if(this._pendingNotificationNames.indexOf(name) > -1) {
- var rq = this._removeQueue[name] = this._removeQueue[name] || [];
- rq.push(obj);
- }
- else{
- this._interests[name].splice(objIndex, 1);
- }
- }
- },
-
- publish : function(notification, data, obj, callback){
-
- if(!(notification instanceof this.__imports.Notification)){
- notification = new this.__imports.Notification(notification, data, callback);
- notification.status = 1;
- notification.pointer = 0;
- notification.dispatcher = obj;
- }
-
- var name = notification.name;
-
- if(this._interests[name]){
- this._pendingNotifications.push(notification);
- this._pendingNotificationNames.push(name);
- this._notifyObjects(notification);
- }
- },
-
- _notifyObjects : function(notification){
-
- var name = notification.name;
-
- while(notification.pointer < this._interests[name].length) {
- if(notification.status === 1){
- if(this._interests[name][notification.pointer].handleNotification){
- this._interests[name][notification.pointer].handleNotification(notification);
- }
- notification.pointer ++;
- }
- else{
- return;
- }
- }
-
- if(notification.status === 1 && !notification.callback) {
- this.cancelNotification(notification);
- }
- },
-
- getNotification : function(name) {
- for(var i = 0; i < this._pendingNotifications.length; i ++){
- if(this._pendingNotifications[i].name === name){
- return this._pendingNotifications[i];
- }
- }
- },
-
- releaseNotification : function(notification){
- notification.status = 1;
- if(this._pendingNotifications.indexOf(notification) > -1){
- this._notifyObjects(notification);
- }
- },
-
- cancelNotification : function(notification){
- if(notification){
-
- var name = notification.name;
-
- this._pendingNotifications.splice(this._pendingNotifications.indexOf(notification), 1);
-
- notification.status = 0;
-
- if(this._removeQueue[name]){
- for(var i = 0; i < this._removeQueue.length; i ++){
- this.unsubscribe(this._removeQueue[name][i], name);
- }
- this._removeQueue[name] = null;
- delete this._removeQueue[name];
- }
-
- notification = null;
- }
- }
-
- })
-
- });
-
- minion.enableNotifications();
-
-})();
View
4 dist/minion-1.4.4.js
@@ -5,7 +5,7 @@
* (c) 2011, Taka Kojima
* Licensed under the MIT License
*
- * Date: Sat Jan 21 23:51:10 2012 -0800
+ * Date: Sat Feb 4 07:13:18 2012 -0800
*/
/**
@@ -1125,7 +1125,7 @@ var minion = (function (root) {
})
});
-})(); (function(){
+})();(function(){
"use strict";
View
4 dist/minion-1.4.4.min.js
@@ -5,6 +5,6 @@
* (c) 2011, Taka Kojima
* Licensed under the MIT License
*
- * Date: Sat Jan 21 23:51:10 2012 -0800
+ * Date: Sat Feb 4 07:13:18 2012 -0800
*/
- var minion=function(a){"use strict",Array.prototype.indexOf=Array.prototype.indexOf||function(a,b){if(!!this.length&&this instanceof Array&&arguments.length>=1){b=b||0;if(b<this.length){while(b<this.length){if(this[b]===a)return b;b+=1}return-1}return-1}return-1};var b=[],c=["minion"],d=".",e="",f="",g,h=[],i=[],j,k=[],l=[],m,n=500,o=typeof window=="undefined",p=a,q={},r=1e4,s={},t=Array._isArray||function(a){return a instanceof Array},u=function(a){return typeof a=="object"},v=function(a){return typeof a=="string"||a instanceof String},w=function(a){return typeof a=="function"},x=function(a){return t(a)?a:[a]},y=function(a,b,c){b=b||[];if(!c)return a||[].concat(b);b=[].concat(b),a=a||[];for(var d=0,e=a.length;d<e;d+=1)b.indexOf(a[d])<0&&(b[b.length]=a[d]);return b},z=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},A=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=null,delete b[c])},B=function(a){a=s.get(a,!1);var b;if(!a.__isDefined)return!1;if(a.__dependencies)for(b=0;b<a.__dependencies.length;b+=1)if(!B(a.__dependencies[b]))return!1;return!0},C=function(){var a,b,c,d,e,f;c={},e={},f=[];for(a=h.length-1;a>=0;a--){c=h[a],d=!0;for(b=0;b<c.c.length;b++){d=B(c.c[b]);if(!d)break}d&&(c.cb&&c.cb.apply(p,s.get(c.c)),h.splice(a,1))}},D=function(){var a=i,b,c,e,f;for(b=a.length-1;b>=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b<a.length;b+=1)c=a[b],c.e+=50,s.isDefined(c.c)?c.s.onload():c.e>=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b<a.f.length;b+=1)o?require(a.f[b]):F(a.f[b],a.c[b]);j=setTimeout(E,n)},H=function(a,b,e){a=a||"",e=e||!1;var f=q,g;if(a&&!u(a)&&!w(a)){var h=a.split(d);c.indexOf(h[0])>-1&&(f=s,h.splice(0,1));for(g=0;g<h.length;g+=1){if(!f[h[g]])if(b)f[h[g]]={};else return!1;f=f[h[g]]}}else if(a!=="")f=a;else return!1;if(e){e.require=y(e.require);var j=e.require;for(var k in e)if(k!=="require"){var l=a+d+k,m=e[k];m.__extendedFrom&&j.push(m.__extendedFrom),m.__toExtend&&i.indexOf(l)<0&&i.push(l),m.__static=m.__static||{},m.__nsID=a,m.__ns=f,m.__class=k,j.length>0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b<a.paths.length;b++){var c=a.paths[b];s.provides(c.file,c.classes)}g=!0},s.alias=function(a){return c.push(a),s},s.get=function(a){if(!t(a))return H(a,!1);var b=s.use(a,{}),c=[];for(var d in b)b.hasOwnProperty(d)&&c.push(b[d]);return c},s.define=function(a,b){var c=H(a,!0,b);return D(),c},s.getURL=function(a){if(b[a])return b[a];var c=a.indexOf("*")>-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d<c.length;d+=1)b[c[d]]=a},s.require=function(a,b){g||s.configure(),a=x(a);var c=[],d=[];for(var e=0;e<a.length;e++){var f=a[e],h=s.getURL(f),i=s.get(f);d.push(f),l.indexOf(h)<0&&!s.get(f)&&(c.push(h),l.push(h))}if(c.length>0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c<a.length;c+=1){e=a[c],f=s.get(e,!0),g=e.split(d),e=g.splice(g.length-1,1)[0],g=s.get(g.join(d),!1);if(e==="*")for(h in g)g.hasOwnProperty(h)&&(b[h]=g[h]);else g[e]&&(b[e]=g[e])}return b},s.enableNotifications=function(){s.isDefined("minion.NotificationManager")&&(m||(m=new(minion.get("minion.NotificationManager")),s.subscribe=function(){m.subscribe.apply(m,arguments)},s.unsubscribe=function(){m.unsubscribe.apply(m,arguments)},s.publish=function(){m.publish.apply(m,arguments)},s.holdNotification=function(){m.holdNotification.apply(m,arguments)},s.releaseNotification=function(){m.releaseNotification.apply(m,arguments)},s.cancelNotification=function(){m.cancelNotification.apply(m,arguments)}))},typeof p.define=="function"&&p.define.amd&&p.define([],function(){return s}),o&&(module.exports=s),s}(this);(function(){"use strict",minion.define("minion",{__BaseClass__:function(){var a=function(a){var b,c,d;if(!a||typeof a!="object")return a;if(a instanceof Date)return(new Date).setTime(a.getTime());if(a instanceof Array)return a.concat();if(typeof a=="object"){d={};for(c in a)a.hasOwnProperty(c)&&(d[c]=a[c]);return d}return a},b=function(a,b){return function(){var c=this.__super||null;this.__super=b;var d=a.apply(this,arguments);return c?this.__super=c:(this.__super=null,delete this.__super),d}},c=/xyz/.test(function(){var a})?/\b__super\b/:/.*/,d=function(){};return d.__isDefined=!0,d.__extend=function(e){var f=this,g=new f("__no_init__"),h={},i=this;for(var j in e)e.hasOwnProperty(j)&&(j!=="__static"?typeof e[j]=="function"&&typeof g[j]=="function"&&c.test(e[j])?g[j]=b(e[j],g[j]):g[j]=e[j]:typeof e[j]=="object"&&j.indexOf("__")!==0&&(h[j]=e[j]));var k=function(){if(arguments[0]!=="__no_init__"){k.prototype.hasOwnProperty("__imports")||(k.prototype.__imports=minion.use(this.__dependencies,{}));if(!this.__preInit){for(var b in h)h.hasOwnProperty(b)&&(this[b]=a(h[b]));return this.init.apply(this,arguments)}return this.__preInit.apply(this,arguments)}};k.prototype=g,k.prototype.constructor=k,k.__extend=d.__extend,k.prototype.__extend=function(a,b){return function(){return b.apply(a,arguments)}}(k,k.__extend),k.__ns=e.__ns||"",k.__nsID=e.__nsID||"",k.__class=e.__class||"",k.__dependencies=e.__dependencies||[];var l;if(e.__static){k.__static=k.__static||{};for(l in e.__static)k[l]||(k[l]=e.__static[l],k.__static[l]=e.__static[l]);k.__static=e.__static}if(this.__static){k.__static=k.__static||{};for(l in this.__static)k[l]||(k[l]=this.__static[l],k.__static[l]=this.__static[l])}if(k.__static.__isStatic){var m=k,n=new m;n.__static=k.__static;for(l in k.__static)n[l]=k.__static[l];return n}return k},d}()})})(),function(){"use strict",minion.define("minion",{Class:minion.extend("minion.__BaseClass__",{__static:{__isDefined:!0},init:function(){this._interestHandlers||(this._interestHandlers=[])},setTimeout:function(a,b){return setTimeout(this.proxy(a),b)},setInterval:function(a,b){return setInterval(this.proxy(a),b)},proxy:function(a){var b=function(a){if(!a)return this;var b=this;return function(){return b.apply(a,Array.prototype.slice.call(arguments))}};return b.call(a,this)},subscribe:function(a,b,c){this._interestHandlers||(this._interestHandlers=[]),b&&!this._interestHandlers[a]&&(minion.subscribe(this,a,c),this._interestHandlers[a]=b)},unsubscribe:function(a){this._interestHandlers&&this._interestHandlers[a]&&(this._interestHandlers[a]=null,delete this._interestHandlers[a]),minion.unsubscribe(this,a)},unsubscribeAll:function(){for(var a in this._interestHandlers)this._interestHandlers.hasOwnProperty(a)&&this.unsubscribe(a);this._interestHandlers=[]},publish:function(a,b,c){minion.publish(a,b,this,c)},handleNotification:function(a){var b=this._interestHandlers[a.name];b&&this.proxy(b)(a)}})})}(),function(){"use strict",minion.define("minion",{Singleton:minion.extend("minion.Class",{init:function(){},__preInit:function(){return this.constructor.__instance?this.constructor.__instance:(this.init.apply(this,arguments),this.constructor.__instance=this,this.constructor.__instance)},__static:{__isSingleton:!0,getInstance:function(){if(!this.__instance){var a=this;return this.__instance=new a,this.__instance}return this.__instance}}})})}(),function(){"use strict",minion.define("minion",{Static:minion.extend("minion.Singleton",{__static:{__isDefined:!0,__isStatic:!0},init:function(){}})})}(),function(){"use strict",minion.define("minion",{Notification:minion.extend("minion.Class",{data:{},name:"",dispatcher:null,status:0,pointer:0,callback:null,init:function(a,b,c){this.name=a,this.data=b,this.callback=c},hold:function(){this.status=2},release:function(){this.status=1,minion.releaseNotification(this)},cancel:function(){minion.cancelNotification(this),this.data={},this.name="",this.status=0,this.pointer=0,this.dispatcher=null,this.callback=null},dispatch:function(a){this.status=1,this.pointer=0,this.dispatcher=a,minion.publish(this)},respond:function(){this.callback&&(this.callback.apply(typeof this.dispatcher=="object"?this.dispatcher:this,arguments),this.callback=null,this.cancel())}})}),minion.define("minion",{require:["minion.Notification"],NotificationManager:minion.extend("minion.Singleton",{_pendingNotifications:[],_pendingNotificationNames:[],_interests:{},_removeQueue:[],subscribe:function(a,b,c){c=isNaN(c)?-1:c,this._interests[b]=this._interests[b]||[],c>-1&&c<this._interests[b].length?this._interests[b].splice(c,0,a):this._interests[b].push(a)},unsubscribe:function(a,b){if(b instanceof Array){for(var c=0;c<b.length;c++)this.unsubscribe(a,b[c]);return}var d=this._interests[b].indexOf(a);if(a&&d>-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer<this._interests[b].length)if(a.status===1)this._interests[b][a.pointer].handleNotification&&this._interests[b][a.pointer].handleNotification(a),a.pointer++;else return;a.status===1&&!a.callback&&this.cancelNotification(a)},getNotification:function(a){for(var b=0;b<this._pendingNotifications.length;b++)if(this._pendingNotifications[b].name===a)return this._pendingNotifications[b]},releaseNotification:function(a){a.status=1,this._pendingNotifications.indexOf(a)>-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c<this._removeQueue.length;c++)this.unsubscribe(this._removeQueue[b][c],b);this._removeQueue[b]=null,delete this._removeQueue[b]}a=null}}})}),minion.enableNotifications()}();
+ var minion=function(a){"use strict",Array.prototype.indexOf=Array.prototype.indexOf||function(a,b){if(!!this.length&&this instanceof Array&&arguments.length>=1){b=b||0;if(b<this.length){while(b<this.length){if(this[b]===a)return b;b+=1}return-1}return-1}return-1};var b=[],c=["minion"],d=".",e="",f="",g,h=[],i=[],j,k=[],l=[],m,n=500,o=typeof window=="undefined",p=a,q={},r=1e4,s={},t=Array._isArray||function(a){return a instanceof Array},u=function(a){return typeof a=="object"},v=function(a){return typeof a=="string"||a instanceof String},w=function(a){return typeof a=="function"},x=function(a){return t(a)?a:[a]},y=function(a,b,c){b=b||[];if(!c)return a||[].concat(b);b=[].concat(b),a=a||[];for(var d=0,e=a.length;d<e;d+=1)b.indexOf(a[d])<0&&(b[b.length]=a[d]);return b},z=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},A=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=null,delete b[c])},B=function(a){a=s.get(a,!1);var b;if(!a.__isDefined)return!1;if(a.__dependencies)for(b=0;b<a.__dependencies.length;b+=1)if(!B(a.__dependencies[b]))return!1;return!0},C=function(){var a,b,c,d,e,f;c={},e={},f=[];for(a=h.length-1;a>=0;a--){c=h[a],d=!0;for(b=0;b<c.c.length;b++){d=B(c.c[b]);if(!d)break}d&&(c.cb&&c.cb.apply(p,s.get(c.c)),h.splice(a,1))}},D=function(){var a=i,b,c,e,f;for(b=a.length-1;b>=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b<a.length;b+=1)c=a[b],c.e+=50,s.isDefined(c.c)?c.s.onload():c.e>=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b<a.f.length;b+=1)o?require(a.f[b]):F(a.f[b],a.c[b]);j=setTimeout(E,n)},H=function(a,b,e){a=a||"",e=e||!1;var f=q,g;if(a&&!u(a)&&!w(a)){var h=a.split(d);c.indexOf(h[0])>-1&&(f=s,h.splice(0,1));for(g=0;g<h.length;g+=1){if(!f[h[g]]){if(!b)return!1;f[h[g]]={}}f=f[h[g]]}}else{if(a==="")return!1;f=a}if(e){e.require=y(e.require);var j=e.require;for(var k in e)if(k!=="require"){var l=a+d+k,m=e[k];m.__extendedFrom&&j.push(m.__extendedFrom),m.__toExtend&&i.indexOf(l)<0&&i.push(l),m.__static=m.__static||{},m.__nsID=a,m.__ns=f,m.__class=k,j.length>0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b<a.paths.length;b++){var c=a.paths[b];s.provides(c.file,c.classes)}g=!0},s.alias=function(a){return c.push(a),s},s.get=function(a){if(!t(a))return H(a,!1);var b=s.use(a,{}),c=[];for(var d in b)b.hasOwnProperty(d)&&c.push(b[d]);return c},s.define=function(a,b){var c=H(a,!0,b);return D(),c},s.getURL=function(a){if(b[a])return b[a];var c=a.indexOf("*")>-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d<c.length;d+=1)b[c[d]]=a},s.require=function(a,b){g||s.configure(),a=x(a);var c=[],d=[];for(var e=0;e<a.length;e++){var f=a[e],h=s.getURL(f),i=s.get(f);d.push(f),l.indexOf(h)<0&&!s.get(f)&&(c.push(h),l.push(h))}if(c.length>0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c<a.length;c+=1){e=a[c],f=s.get(e,!0),g=e.split(d),e=g.splice(g.length-1,1)[0],g=s.get(g.join(d),!1);if(e==="*")for(h in g)g.hasOwnProperty(h)&&(b[h]=g[h]);else g[e]&&(b[e]=g[e])}return b},s.enableNotifications=function(){s.isDefined("minion.NotificationManager")&&(m||(m=new(minion.get("minion.NotificationManager")),s.subscribe=function(){m.subscribe.apply(m,arguments)},s.unsubscribe=function(){m.unsubscribe.apply(m,arguments)},s.publish=function(){m.publish.apply(m,arguments)},s.holdNotification=function(){m.holdNotification.apply(m,arguments)},s.releaseNotification=function(){m.releaseNotification.apply(m,arguments)},s.cancelNotification=function(){m.cancelNotification.apply(m,arguments)}))},typeof p.define=="function"&&p.define.amd&&p.define([],function(){return s}),o&&(module.exports=s),s}(this);(function(){"use strict",minion.define("minion",{__BaseClass__:function(){var a=function(a){var b,c,d;if(!a||typeof a!="object")return a;if(a instanceof Date)return(new Date).setTime(a.getTime());if(a instanceof Array)return a.concat();if(typeof a=="object"){d={};for(c in a)a.hasOwnProperty(c)&&(d[c]=a[c]);return d}return a},b=function(a,b){return function(){var c=this.__super||null;this.__super=b;var d=a.apply(this,arguments);return c?this.__super=c:(this.__super=null,delete this.__super),d}},c=/xyz/.test(function(){var a})?/\b__super\b/:/.*/,d=function(){};return d.__isDefined=!0,d.__extend=function(e){var f=this,g=new f("__no_init__"),h={},i=this;for(var j in e)e.hasOwnProperty(j)&&(j!=="__static"?typeof e[j]=="function"&&typeof g[j]=="function"&&c.test(e[j])?g[j]=b(e[j],g[j]):g[j]=e[j]:typeof e[j]=="object"&&j.indexOf("__")!==0&&(h[j]=e[j]));var k=function(){if(arguments[0]!=="__no_init__"){k.prototype.hasOwnProperty("__imports")||(k.prototype.__imports=minion.use(this.__dependencies,{}));if(!this.__preInit){for(var b in h)h.hasOwnProperty(b)&&(this[b]=a(h[b]));return this.init.apply(this,arguments)}return this.__preInit.apply(this,arguments)}};k.prototype=g,k.prototype.constructor=k,k.__extend=d.__extend,k.prototype.__extend=function(a,b){return function(){return b.apply(a,arguments)}}(k,k.__extend),k.__ns=e.__ns||"",k.__nsID=e.__nsID||"",k.__class=e.__class||"",k.__dependencies=e.__dependencies||[];var l;if(e.__static){k.__static=k.__static||{};for(l in e.__static)k[l]||(k[l]=e.__static[l],k.__static[l]=e.__static[l]);k.__static=e.__static}if(this.__static){k.__static=k.__static||{};for(l in this.__static)k[l]||(k[l]=this.__static[l],k.__static[l]=this.__static[l])}if(k.__static.__isStatic){var m=k,n=new m;n.__static=k.__static;for(l in k.__static)n[l]=k.__static[l];return n}return k},d}()})})(),function(){"use strict",minion.define("minion",{Class:minion.extend("minion.__BaseClass__",{__static:{__isDefined:!0},init:function(){this._interestHandlers||(this._interestHandlers=[])},setTimeout:function(a,b){return setTimeout(this.proxy(a),b)},setInterval:function(a,b){return setInterval(this.proxy(a),b)},proxy:function(a){var b=function(a){if(!a)return this;var b=this;return function(){return b.apply(a,Array.prototype.slice.call(arguments))}};return b.call(a,this)},subscribe:function(a,b,c){this._interestHandlers||(this._interestHandlers=[]),b&&!this._interestHandlers[a]&&(minion.subscribe(this,a,c),this._interestHandlers[a]=b)},unsubscribe:function(a){this._interestHandlers&&this._interestHandlers[a]&&(this._interestHandlers[a]=null,delete this._interestHandlers[a]),minion.unsubscribe(this,a)},unsubscribeAll:function(){for(var a in this._interestHandlers)this._interestHandlers.hasOwnProperty(a)&&this.unsubscribe(a);this._interestHandlers=[]},publish:function(a,b,c){minion.publish(a,b,this,c)},handleNotification:function(a){var b=this._interestHandlers[a.name];b&&this.proxy(b)(a)}})})}(),function(){"use strict",minion.define("minion",{Singleton:minion.extend("minion.Class",{init:function(){},__preInit:function(){return this.constructor.__instance?this.constructor.__instance:(this.init.apply(this,arguments),this.constructor.__instance=this,this.constructor.__instance)},__static:{__isSingleton:!0,getInstance:function(){if(!this.__instance){var a=this;return this.__instance=new a,this.__instance}return this.__instance}}})})}(),function(){"use strict",minion.define("minion",{Static:minion.extend("minion.Singleton",{__static:{__isDefined:!0,__isStatic:!0},init:function(){}})})}(),function(){"use strict",minion.define("minion",{Notification:minion.extend("minion.Class",{data:{},name:"",dispatcher:null,status:0,pointer:0,callback:null,init:function(a,b,c){this.name=a,this.data=b,this.callback=c},hold:function(){this.status=2},release:function(){this.status=1,minion.releaseNotification(this)},cancel:function(){minion.cancelNotification(this),this.data={},this.name="",this.status=0,this.pointer=0,this.dispatcher=null,this.callback=null},dispatch:function(a){this.status=1,this.pointer=0,this.dispatcher=a,minion.publish(this)},respond:function(){this.callback&&(this.callback.apply(typeof this.dispatcher=="object"?this.dispatcher:this,arguments),this.callback=null,this.cancel())}})}),minion.define("minion",{require:["minion.Notification"],NotificationManager:minion.extend("minion.Singleton",{_pendingNotifications:[],_pendingNotificationNames:[],_interests:{},_removeQueue:[],subscribe:function(a,b,c){c=isNaN(c)?-1:c,this._interests[b]=this._interests[b]||[],c>-1&&c<this._interests[b].length?this._interests[b].splice(c,0,a):this._interests[b].push(a)},unsubscribe:function(a,b){if(b instanceof Array){for(var c=0;c<b.length;c++)this.unsubscribe(a,b[c]);return}var d=this._interests[b].indexOf(a);if(a&&d>-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer<this._interests[b].length){if(a.status!==1)return;this._interests[b][a.pointer].handleNotification&&this._interests[b][a.pointer].handleNotification(a),a.pointer++}a.status===1&&!a.callback&&this.cancelNotification(a)},getNotification:function(a){for(var b=0;b<this._pendingNotifications.length;b++)if(this._pendingNotifications[b].name===a)return this._pendingNotifications[b]},releaseNotification:function(a){a.status=1,this._pendingNotifications.indexOf(a)>-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c<this._removeQueue.length;c++)this.unsubscribe(this._removeQueue[b][c],b);this._removeQueue[b]=null,delete this._removeQueue[b]}a=null}}})}),minion.enableNotifications()}();
View
4 dist/minion-latest.js
@@ -5,7 +5,7 @@
* (c) 2011, Taka Kojima
* Licensed under the MIT License
*
- * Date: Sat Jan 21 23:51:10 2012 -0800
+ * Date: Sat Feb 4 07:13:18 2012 -0800
*/
/**
@@ -1125,7 +1125,7 @@ var minion = (function (root) {
})
});
-})(); (function(){
+})();(function(){
"use strict";
View
4 dist/minion-latest.min.js
@@ -5,6 +5,6 @@
* (c) 2011, Taka Kojima
* Licensed under the MIT License
*
- * Date: Sat Jan 21 23:51:10 2012 -0800
+ * Date: Sat Feb 4 07:13:18 2012 -0800
*/
- var minion=function(a){"use strict",Array.prototype.indexOf=Array.prototype.indexOf||function(a,b){if(!!this.length&&this instanceof Array&&arguments.length>=1){b=b||0;if(b<this.length){while(b<this.length){if(this[b]===a)return b;b+=1}return-1}return-1}return-1};var b=[],c=["minion"],d=".",e="",f="",g,h=[],i=[],j,k=[],l=[],m,n=500,o=typeof window=="undefined",p=a,q={},r=1e4,s={},t=Array._isArray||function(a){return a instanceof Array},u=function(a){return typeof a=="object"},v=function(a){return typeof a=="string"||a instanceof String},w=function(a){return typeof a=="function"},x=function(a){return t(a)?a:[a]},y=function(a,b,c){b=b||[];if(!c)return a||[].concat(b);b=[].concat(b),a=a||[];for(var d=0,e=a.length;d<e;d+=1)b.indexOf(a[d])<0&&(b[b.length]=a[d]);return b},z=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},A=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=null,delete b[c])},B=function(a){a=s.get(a,!1);var b;if(!a.__isDefined)return!1;if(a.__dependencies)for(b=0;b<a.__dependencies.length;b+=1)if(!B(a.__dependencies[b]))return!1;return!0},C=function(){var a,b,c,d,e,f;c={},e={},f=[];for(a=h.length-1;a>=0;a--){c=h[a],d=!0;for(b=0;b<c.c.length;b++){d=B(c.c[b]);if(!d)break}d&&(c.cb&&c.cb.apply(p,s.get(c.c)),h.splice(a,1))}},D=function(){var a=i,b,c,e,f;for(b=a.length-1;b>=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b<a.length;b+=1)c=a[b],c.e+=50,s.isDefined(c.c)?c.s.onload():c.e>=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b<a.f.length;b+=1)o?require(a.f[b]):F(a.f[b],a.c[b]);j=setTimeout(E,n)},H=function(a,b,e){a=a||"",e=e||!1;var f=q,g;if(a&&!u(a)&&!w(a)){var h=a.split(d);c.indexOf(h[0])>-1&&(f=s,h.splice(0,1));for(g=0;g<h.length;g+=1){if(!f[h[g]])if(b)f[h[g]]={};else return!1;f=f[h[g]]}}else if(a!=="")f=a;else return!1;if(e){e.require=y(e.require);var j=e.require;for(var k in e)if(k!=="require"){var l=a+d+k,m=e[k];m.__extendedFrom&&j.push(m.__extendedFrom),m.__toExtend&&i.indexOf(l)<0&&i.push(l),m.__static=m.__static||{},m.__nsID=a,m.__ns=f,m.__class=k,j.length>0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b<a.paths.length;b++){var c=a.paths[b];s.provides(c.file,c.classes)}g=!0},s.alias=function(a){return c.push(a),s},s.get=function(a){if(!t(a))return H(a,!1);var b=s.use(a,{}),c=[];for(var d in b)b.hasOwnProperty(d)&&c.push(b[d]);return c},s.define=function(a,b){var c=H(a,!0,b);return D(),c},s.getURL=function(a){if(b[a])return b[a];var c=a.indexOf("*")>-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d<c.length;d+=1)b[c[d]]=a},s.require=function(a,b){g||s.configure(),a=x(a);var c=[],d=[];for(var e=0;e<a.length;e++){var f=a[e],h=s.getURL(f),i=s.get(f);d.push(f),l.indexOf(h)<0&&!s.get(f)&&(c.push(h),l.push(h))}if(c.length>0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c<a.length;c+=1){e=a[c],f=s.get(e,!0),g=e.split(d),e=g.splice(g.length-1,1)[0],g=s.get(g.join(d),!1);if(e==="*")for(h in g)g.hasOwnProperty(h)&&(b[h]=g[h]);else g[e]&&(b[e]=g[e])}return b},s.enableNotifications=function(){s.isDefined("minion.NotificationManager")&&(m||(m=new(minion.get("minion.NotificationManager")),s.subscribe=function(){m.subscribe.apply(m,arguments)},s.unsubscribe=function(){m.unsubscribe.apply(m,arguments)},s.publish=function(){m.publish.apply(m,arguments)},s.holdNotification=function(){m.holdNotification.apply(m,arguments)},s.releaseNotification=function(){m.releaseNotification.apply(m,arguments)},s.cancelNotification=function(){m.cancelNotification.apply(m,arguments)}))},typeof p.define=="function"&&p.define.amd&&p.define([],function(){return s}),o&&(module.exports=s),s}(this);(function(){"use strict",minion.define("minion",{__BaseClass__:function(){var a=function(a){var b,c,d;if(!a||typeof a!="object")return a;if(a instanceof Date)return(new Date).setTime(a.getTime());if(a instanceof Array)return a.concat();if(typeof a=="object"){d={};for(c in a)a.hasOwnProperty(c)&&(d[c]=a[c]);return d}return a},b=function(a,b){return function(){var c=this.__super||null;this.__super=b;var d=a.apply(this,arguments);return c?this.__super=c:(this.__super=null,delete this.__super),d}},c=/xyz/.test(function(){var a})?/\b__super\b/:/.*/,d=function(){};return d.__isDefined=!0,d.__extend=function(e){var f=this,g=new f("__no_init__"),h={},i=this;for(var j in e)e.hasOwnProperty(j)&&(j!=="__static"?typeof e[j]=="function"&&typeof g[j]=="function"&&c.test(e[j])?g[j]=b(e[j],g[j]):g[j]=e[j]:typeof e[j]=="object"&&j.indexOf("__")!==0&&(h[j]=e[j]));var k=function(){if(arguments[0]!=="__no_init__"){k.prototype.hasOwnProperty("__imports")||(k.prototype.__imports=minion.use(this.__dependencies,{}));if(!this.__preInit){for(var b in h)h.hasOwnProperty(b)&&(this[b]=a(h[b]));return this.init.apply(this,arguments)}return this.__preInit.apply(this,arguments)}};k.prototype=g,k.prototype.constructor=k,k.__extend=d.__extend,k.prototype.__extend=function(a,b){return function(){return b.apply(a,arguments)}}(k,k.__extend),k.__ns=e.__ns||"",k.__nsID=e.__nsID||"",k.__class=e.__class||"",k.__dependencies=e.__dependencies||[];var l;if(e.__static){k.__static=k.__static||{};for(l in e.__static)k[l]||(k[l]=e.__static[l],k.__static[l]=e.__static[l]);k.__static=e.__static}if(this.__static){k.__static=k.__static||{};for(l in this.__static)k[l]||(k[l]=this.__static[l],k.__static[l]=this.__static[l])}if(k.__static.__isStatic){var m=k,n=new m;n.__static=k.__static;for(l in k.__static)n[l]=k.__static[l];return n}return k},d}()})})(),function(){"use strict",minion.define("minion",{Class:minion.extend("minion.__BaseClass__",{__static:{__isDefined:!0},init:function(){this._interestHandlers||(this._interestHandlers=[])},setTimeout:function(a,b){return setTimeout(this.proxy(a),b)},setInterval:function(a,b){return setInterval(this.proxy(a),b)},proxy:function(a){var b=function(a){if(!a)return this;var b=this;return function(){return b.apply(a,Array.prototype.slice.call(arguments))}};return b.call(a,this)},subscribe:function(a,b,c){this._interestHandlers||(this._interestHandlers=[]),b&&!this._interestHandlers[a]&&(minion.subscribe(this,a,c),this._interestHandlers[a]=b)},unsubscribe:function(a){this._interestHandlers&&this._interestHandlers[a]&&(this._interestHandlers[a]=null,delete this._interestHandlers[a]),minion.unsubscribe(this,a)},unsubscribeAll:function(){for(var a in this._interestHandlers)this._interestHandlers.hasOwnProperty(a)&&this.unsubscribe(a);this._interestHandlers=[]},publish:function(a,b,c){minion.publish(a,b,this,c)},handleNotification:function(a){var b=this._interestHandlers[a.name];b&&this.proxy(b)(a)}})})}(),function(){"use strict",minion.define("minion",{Singleton:minion.extend("minion.Class",{init:function(){},__preInit:function(){return this.constructor.__instance?this.constructor.__instance:(this.init.apply(this,arguments),this.constructor.__instance=this,this.constructor.__instance)},__static:{__isSingleton:!0,getInstance:function(){if(!this.__instance){var a=this;return this.__instance=new a,this.__instance}return this.__instance}}})})}(),function(){"use strict",minion.define("minion",{Static:minion.extend("minion.Singleton",{__static:{__isDefined:!0,__isStatic:!0},init:function(){}})})}(),function(){"use strict",minion.define("minion",{Notification:minion.extend("minion.Class",{data:{},name:"",dispatcher:null,status:0,pointer:0,callback:null,init:function(a,b,c){this.name=a,this.data=b,this.callback=c},hold:function(){this.status=2},release:function(){this.status=1,minion.releaseNotification(this)},cancel:function(){minion.cancelNotification(this),this.data={},this.name="",this.status=0,this.pointer=0,this.dispatcher=null,this.callback=null},dispatch:function(a){this.status=1,this.pointer=0,this.dispatcher=a,minion.publish(this)},respond:function(){this.callback&&(this.callback.apply(typeof this.dispatcher=="object"?this.dispatcher:this,arguments),this.callback=null,this.cancel())}})}),minion.define("minion",{require:["minion.Notification"],NotificationManager:minion.extend("minion.Singleton",{_pendingNotifications:[],_pendingNotificationNames:[],_interests:{},_removeQueue:[],subscribe:function(a,b,c){c=isNaN(c)?-1:c,this._interests[b]=this._interests[b]||[],c>-1&&c<this._interests[b].length?this._interests[b].splice(c,0,a):this._interests[b].push(a)},unsubscribe:function(a,b){if(b instanceof Array){for(var c=0;c<b.length;c++)this.unsubscribe(a,b[c]);return}var d=this._interests[b].indexOf(a);if(a&&d>-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer<this._interests[b].length)if(a.status===1)this._interests[b][a.pointer].handleNotification&&this._interests[b][a.pointer].handleNotification(a),a.pointer++;else return;a.status===1&&!a.callback&&this.cancelNotification(a)},getNotification:function(a){for(var b=0;b<this._pendingNotifications.length;b++)if(this._pendingNotifications[b].name===a)return this._pendingNotifications[b]},releaseNotification:function(a){a.status=1,this._pendingNotifications.indexOf(a)>-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c<this._removeQueue.length;c++)this.unsubscribe(this._removeQueue[b][c],b);this._removeQueue[b]=null,delete this._removeQueue[b]}a=null}}})}),minion.enableNotifications()}();
+ var minion=function(a){"use strict",Array.prototype.indexOf=Array.prototype.indexOf||function(a,b){if(!!this.length&&this instanceof Array&&arguments.length>=1){b=b||0;if(b<this.length){while(b<this.length){if(this[b]===a)return b;b+=1}return-1}return-1}return-1};var b=[],c=["minion"],d=".",e="",f="",g,h=[],i=[],j,k=[],l=[],m,n=500,o=typeof window=="undefined",p=a,q={},r=1e4,s={},t=Array._isArray||function(a){return a instanceof Array},u=function(a){return typeof a=="object"},v=function(a){return typeof a=="string"||a instanceof String},w=function(a){return typeof a=="function"},x=function(a){return t(a)?a:[a]},y=function(a,b,c){b=b||[];if(!c)return a||[].concat(b);b=[].concat(b),a=a||[];for(var d=0,e=a.length;d<e;d+=1)b.indexOf(a[d])<0&&(b[b.length]=a[d]);return b},z=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},A=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=null,delete b[c])},B=function(a){a=s.get(a,!1);var b;if(!a.__isDefined)return!1;if(a.__dependencies)for(b=0;b<a.__dependencies.length;b+=1)if(!B(a.__dependencies[b]))return!1;return!0},C=function(){var a,b,c,d,e,f;c={},e={},f=[];for(a=h.length-1;a>=0;a--){c=h[a],d=!0;for(b=0;b<c.c.length;b++){d=B(c.c[b]);if(!d)break}d&&(c.cb&&c.cb.apply(p,s.get(c.c)),h.splice(a,1))}},D=function(){var a=i,b,c,e,f;for(b=a.length-1;b>=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b<a.length;b+=1)c=a[b],c.e+=50,s.isDefined(c.c)?c.s.onload():c.e>=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b<a.f.length;b+=1)o?require(a.f[b]):F(a.f[b],a.c[b]);j=setTimeout(E,n)},H=function(a,b,e){a=a||"",e=e||!1;var f=q,g;if(a&&!u(a)&&!w(a)){var h=a.split(d);c.indexOf(h[0])>-1&&(f=s,h.splice(0,1));for(g=0;g<h.length;g+=1){if(!f[h[g]]){if(!b)return!1;f[h[g]]={}}f=f[h[g]]}}else{if(a==="")return!1;f=a}if(e){e.require=y(e.require);var j=e.require;for(var k in e)if(k!=="require"){var l=a+d+k,m=e[k];m.__extendedFrom&&j.push(m.__extendedFrom),m.__toExtend&&i.indexOf(l)<0&&i.push(l),m.__static=m.__static||{},m.__nsID=a,m.__ns=f,m.__class=k,j.length>0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b<a.paths.length;b++){var c=a.paths[b];s.provides(c.file,c.classes)}g=!0},s.alias=function(a){return c.push(a),s},s.get=function(a){if(!t(a))return H(a,!1);var b=s.use(a,{}),c=[];for(var d in b)b.hasOwnProperty(d)&&c.push(b[d]);return c},s.define=function(a,b){var c=H(a,!0,b);return D(),c},s.getURL=function(a){if(b[a])return b[a];var c=a.indexOf("*")>-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d<c.length;d+=1)b[c[d]]=a},s.require=function(a,b){g||s.configure(),a=x(a);var c=[],d=[];for(var e=0;e<a.length;e++){var f=a[e],h=s.getURL(f),i=s.get(f);d.push(f),l.indexOf(h)<0&&!s.get(f)&&(c.push(h),l.push(h))}if(c.length>0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c<a.length;c+=1){e=a[c],f=s.get(e,!0),g=e.split(d),e=g.splice(g.length-1,1)[0],g=s.get(g.join(d),!1);if(e==="*")for(h in g)g.hasOwnProperty(h)&&(b[h]=g[h]);else g[e]&&(b[e]=g[e])}return b},s.enableNotifications=function(){s.isDefined("minion.NotificationManager")&&(m||(m=new(minion.get("minion.NotificationManager")),s.subscribe=function(){m.subscribe.apply(m,arguments)},s.unsubscribe=function(){m.unsubscribe.apply(m,arguments)},s.publish=function(){m.publish.apply(m,arguments)},s.holdNotification=function(){m.holdNotification.apply(m,arguments)},s.releaseNotification=function(){m.releaseNotification.apply(m,arguments)},s.cancelNotification=function(){m.cancelNotification.apply(m,arguments)}))},typeof p.define=="function"&&p.define.amd&&p.define([],function(){return s}),o&&(module.exports=s),s}(this);(function(){"use strict",minion.define("minion",{__BaseClass__:function(){var a=function(a){var b,c,d;if(!a||typeof a!="object")return a;if(a instanceof Date)return(new Date).setTime(a.getTime());if(a instanceof Array)return a.concat();if(typeof a=="object"){d={};for(c in a)a.hasOwnProperty(c)&&(d[c]=a[c]);return d}return a},b=function(a,b){return function(){var c=this.__super||null;this.__super=b;var d=a.apply(this,arguments);return c?this.__super=c:(this.__super=null,delete this.__super),d}},c=/xyz/.test(function(){var a})?/\b__super\b/:/.*/,d=function(){};return d.__isDefined=!0,d.__extend=function(e){var f=this,g=new f("__no_init__"),h={},i=this;for(var j in e)e.hasOwnProperty(j)&&(j!=="__static"?typeof e[j]=="function"&&typeof g[j]=="function"&&c.test(e[j])?g[j]=b(e[j],g[j]):g[j]=e[j]:typeof e[j]=="object"&&j.indexOf("__")!==0&&(h[j]=e[j]));var k=function(){if(arguments[0]!=="__no_init__"){k.prototype.hasOwnProperty("__imports")||(k.prototype.__imports=minion.use(this.__dependencies,{}));if(!this.__preInit){for(var b in h)h.hasOwnProperty(b)&&(this[b]=a(h[b]));return this.init.apply(this,arguments)}return this.__preInit.apply(this,arguments)}};k.prototype=g,k.prototype.constructor=k,k.__extend=d.__extend,k.prototype.__extend=function(a,b){return function(){return b.apply(a,arguments)}}(k,k.__extend),k.__ns=e.__ns||"",k.__nsID=e.__nsID||"",k.__class=e.__class||"",k.__dependencies=e.__dependencies||[];var l;if(e.__static){k.__static=k.__static||{};for(l in e.__static)k[l]||(k[l]=e.__static[l],k.__static[l]=e.__static[l]);k.__static=e.__static}if(this.__static){k.__static=k.__static||{};for(l in this.__static)k[l]||(k[l]=this.__static[l],k.__static[l]=this.__static[l])}if(k.__static.__isStatic){var m=k,n=new m;n.__static=k.__static;for(l in k.__static)n[l]=k.__static[l];return n}return k},d}()})})(),function(){"use strict",minion.define("minion",{Class:minion.extend("minion.__BaseClass__",{__static:{__isDefined:!0},init:function(){this._interestHandlers||(this._interestHandlers=[])},setTimeout:function(a,b){return setTimeout(this.proxy(a),b)},setInterval:function(a,b){return setInterval(this.proxy(a),b)},proxy:function(a){var b=function(a){if(!a)return this;var b=this;return function(){return b.apply(a,Array.prototype.slice.call(arguments))}};return b.call(a,this)},subscribe:function(a,b,c){this._interestHandlers||(this._interestHandlers=[]),b&&!this._interestHandlers[a]&&(minion.subscribe(this,a,c),this._interestHandlers[a]=b)},unsubscribe:function(a){this._interestHandlers&&this._interestHandlers[a]&&(this._interestHandlers[a]=null,delete this._interestHandlers[a]),minion.unsubscribe(this,a)},unsubscribeAll:function(){for(var a in this._interestHandlers)this._interestHandlers.hasOwnProperty(a)&&this.unsubscribe(a);this._interestHandlers=[]},publish:function(a,b,c){minion.publish(a,b,this,c)},handleNotification:function(a){var b=this._interestHandlers[a.name];b&&this.proxy(b)(a)}})})}(),function(){"use strict",minion.define("minion",{Singleton:minion.extend("minion.Class",{init:function(){},__preInit:function(){return this.constructor.__instance?this.constructor.__instance:(this.init.apply(this,arguments),this.constructor.__instance=this,this.constructor.__instance)},__static:{__isSingleton:!0,getInstance:function(){if(!this.__instance){var a=this;return this.__instance=new a,this.__instance}return this.__instance}}})})}(),function(){"use strict",minion.define("minion",{Static:minion.extend("minion.Singleton",{__static:{__isDefined:!0,__isStatic:!0},init:function(){}})})}(),function(){"use strict",minion.define("minion",{Notification:minion.extend("minion.Class",{data:{},name:"",dispatcher:null,status:0,pointer:0,callback:null,init:function(a,b,c){this.name=a,this.data=b,this.callback=c},hold:function(){this.status=2},release:function(){this.status=1,minion.releaseNotification(this)},cancel:function(){minion.cancelNotification(this),this.data={},this.name="",this.status=0,this.pointer=0,this.dispatcher=null,this.callback=null},dispatch:function(a){this.status=1,this.pointer=0,this.dispatcher=a,minion.publish(this)},respond:function(){this.callback&&(this.callback.apply(typeof this.dispatcher=="object"?this.dispatcher:this,arguments),this.callback=null,this.cancel())}})}),minion.define("minion",{require:["minion.Notification"],NotificationManager:minion.extend("minion.Singleton",{_pendingNotifications:[],_pendingNotificationNames:[],_interests:{},_removeQueue:[],subscribe:function(a,b,c){c=isNaN(c)?-1:c,this._interests[b]=this._interests[b]||[],c>-1&&c<this._interests[b].length?this._interests[b].splice(c,0,a):this._interests[b].push(a)},unsubscribe:function(a,b){if(b instanceof Array){for(var c=0;c<b.length;c++)this.unsubscribe(a,b[c]);return}var d=this._interests[b].indexOf(a);if(a&&d>-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer<this._interests[b].length){if(a.status!==1)return;this._interests[b][a.pointer].handleNotification&&this._interests[b][a.pointer].handleNotification(a),a.pointer++}a.status===1&&!a.callback&&this.cancelNotification(a)},getNotification:function(a){for(var b=0;b<this._pendingNotifications.length;b++)if(this._pendingNotifications[b].name===a)return this._pendingNotifications[b]},releaseNotification:function(a){a.status=1,this._pendingNotifications.indexOf(a)>-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c<this._removeQueue.length;c++)this.unsubscribe(this._removeQueue[b][c],b);this._removeQueue[b]=null,delete this._removeQueue[b]}a=null}}})}),minion.enableNotifications()}();
View
0  getting_started.md → docs/getting_started.md
File renamed without changes
View
0  bin/sample.conf.json → docs/sample.conf.json
File renamed without changes
1  gh-pages
@@ -1 +0,0 @@
-Subproject commit e9cbf120975b62b4e4136b19d49337af6ce9439e
View
14 src/minion.baseclass.js → lib/minion.baseclass.js
@@ -6,11 +6,11 @@
minion.define("minion", {
/**
- * The minion Base Class
- * Classical JavaScript Inheritance (or an attempt thereof)
- * minion.Class is the ONLY Class to extend this directly, do not directly extend this Class.
- * Largely taken from: http://ejohn.org/blog/simple-javascript-inheritance/
- * @ignore */
+ The minion Base Class
+ Classical JavaScript Inheritance (or an attempt thereof)
+ minion.Class is the ONLY Class to extend this directly, do not directly extend this Class.
+ Largely taken from: http://ejohn.org/blog/simple-javascript-inheritance/
+ */
__BaseClass__ : (function() {
@@ -67,12 +67,10 @@
// Checks the function contents to see if it has a reference to __super
var _doesCallSuper = /xyz/.test(function(){var xyz;}) ? /\b__super\b/ : /.*/;
- /** @ignore */
var _baseClass = function(){};
_baseClass.__isDefined = true;
- /** @ignore */
_baseClass.__extend = function(obj) {
// By passing "__no_init__" as the first argument, we skip calling the constructor and other initialization;
@@ -114,8 +112,6 @@
Handy for referencing dependencies. If a Class requires example.Test, then you can reference said class
in any method by this.__imports.Test;
- This method is preferred over this.use_dependencies(), as you have to explicitly call this.unuse_dependencies()
- to be responsible, at the end of every method.
*/
if(!_class.prototype.hasOwnProperty("__imports")){
_class.prototype.__imports = minion.use(this.__dependencies, {});
View
28 src/minion.class.js → lib/minion.class.js
@@ -12,13 +12,11 @@
__isDefined: true
},
- /**
- *
+ /**
* The base minion Class. All Classes are required to be descendants
* of this class, either directly, or indirectly.
- *
- * @constructs
*/
+
init: function(){
if(!this._interestHandlers){
this._interestHandlers = [];
@@ -27,8 +25,6 @@
/**
* Local version of window.setTimeout that keeps scope of <i>this</i>.<br>
- *
- * @returns {Number} A timeout ID
*/
setTimeout : function(func, delay){
return setTimeout(this.proxy(func), delay);
@@ -36,18 +32,14 @@
/**
* Local version of window.setInterval that keeps scope of <i>this</i>.<br>
- *
- * @returns {Number} An interval ID
*/
setInterval : function(func, delay){
return setInterval(this.proxy(func), delay);
},
/**
- * Shorthand for <i>func.bind(this)</i><br>
- * or rather, <i>$.proxy(func, this)</i> in jQuery terms
- *
- * @returns {Function} The proxied function
+ * Shorthand for func.bind(this)
+ * or rather, $.proxy(func, this) in jQuery terms
*/
proxy : function(func){
var bind = function (context) {
@@ -63,10 +55,6 @@
/**
* Subscribes to a notification.
- *
- * @public
- * @param {String} name The name of the Notification you are subscribing to.
- * @param {Function} handler A function to be called upon receiving the given Notification.
*/
subscribe : function(name, handler, priority){
@@ -81,9 +69,6 @@
/**
* Unsubscribes from a notification.
- *
- * @public
- * @param {String} name The name of the Notification you are unsubscribing from.
*/
unsubscribe : function(name){
@@ -109,17 +94,12 @@
/**
* Publishes a notification with the specified data.
- *
- * @param {String} name The name of the Notification you are publishing.
- * @param {Object} data An object of data you want to send with the Notification.
- * @param {Function} callback A callback function to be invoked if Notification.respond() is called
*/
publish : function(name, data, callback){
minion.publish(name, data, this, callback);
},
- /** @ignore */
handleNotification : function(n){
var handler = this._interestHandlers[n.name];
if(handler){
View
2  src/minion.header.js → lib/minion.header.js
@@ -2,7 +2,7 @@
* minion.JS v@VERSION
* http://minion.org
*
- * (c) 2011, Taka Kojima
+ * (c) 2012, Taka Kojima (taka@gigafied.com)
* Licensed under the MIT License
*
* Date: @DATE
View
16 lib/minion.js
@@ -0,0 +1,16 @@
+/*
+ Yes, we're assigning "minion" as a global var. Deal with it, it solves more issues than it creates doing it this way.
+ The reason being, as a huge part of Minion is working in the browser, minion is a global var in the browser.
+ Thus, it carries over into node.js.
+*/
+
+module.exports = minion = require("./minion.main.js");
+
+require("./minion.baseclass.js");
+require("./minion.class.js");
+require("./minion.singleton.js");
+require("./minion.static.js");
+require("./minion.notifications.js");
+require("./minion.node.js");
+
+minion.build();
View
94 src/minion.main.js → lib/minion.main.js
@@ -34,6 +34,8 @@ THE SOFTWARE.</p>
TODO:
- Multiple inheritance
- Independent library support, i.e. ability to do minion.require("minion.libs.jquery") to load jquery
+ - AMD Compliant?
+ - minion.provides("namespace.*");
- __preDefine method on Classes, takes 1 argument, a callback that gets called once __preDefine does all it needs to do
*/
@@ -86,40 +88,30 @@ var minion = (function (root) {
var _ns = {};
var _errorTimeout = 1e4;
- /**
- * @exports _minion as minion
- * @class
- */
var _minion = {};
/*================= HELPER FUNCTIONS =================*/
- /** @private */
var _isArray = Array._isArray || function (a) {
return a instanceof Array;
};
- /** @private */
var _isObject = function (obj) {
return typeof obj === "object";
};
- /** @private */
var _isString = function (s) {
return typeof s === 'string' || s instanceof String;
};
- /** @private */
var _isFunction = function (fn) {
return typeof fn === "function";
};
- /** @private */
var _strToArray = function (s) {
return (!_isArray(s)) ? [s] : s;
};
- /** @private */
var _concatArray = function (a, b, forceUnique) {
b = b || [];
if(!forceUnique){
@@ -139,7 +131,6 @@ var minion = (function (root) {
return b;
};
- /** @private */
var _copyToNS = function(o1,o2){
for (var i in o1) {
if(o1.hasOwnProperty(i)){
@@ -148,7 +139,6 @@ var minion = (function (root) {
}
};
- /** @private */
var _removeFromNS = function(o1,o2){
for (var i in o1) {
if(o1.hasOwnProperty(i)){
@@ -160,7 +150,7 @@ var minion = (function (root) {
// Recursively checks dependencies
- /** @private */
+
var _areDependenciesLoaded = function (o) {
o = _minion.get(o, false);
var i;
@@ -178,7 +168,7 @@ var minion = (function (root) {
return true;
};
- /** @private */
+
var _checkLoadQueue = function () {
var i, j, q, dependenciesLoaded, classes, classesArray;
q = {};
@@ -206,7 +196,7 @@ var minion = (function (root) {
}
};
- /** @private */
+
var _checkExtendQueue = function () {
var eq = _extendQueue;
var i, superClass, ns, id;
@@ -235,7 +225,7 @@ var minion = (function (root) {
_checkLoadQueue();
};
- /** @private */
+
var _checkWaitQueue = function () {
var w = _waitingForLoad;
@@ -265,10 +255,6 @@ var minion = (function (root) {
/**
* Injects a Script tag into the DOM
- *
- * @param f The path of the file to inject.
- * @param c The class which maps to the file we are injecting.
- * @private
*/
var _inject = function(f, c) {
@@ -296,7 +282,6 @@ var minion = (function (root) {
_waitingForLoad.push(injectObj);
- /** @ignore */
script.onreadystatechange = /** @ignore */ script.onload = function (e) {
if (_minion.isDefined(c)) {
injectObj.s.onload = injectObj.s.onreadystatechange = null;
@@ -305,7 +290,6 @@ var minion = (function (root) {
}
};
- /** @ignore */
script.onerror = function (e) {
injectObj.s.onerror = null;
_waitingForLoad.splice(_waitingForLoad.indexOf(injectObj), 1);
@@ -320,9 +304,6 @@ var minion = (function (root) {
/**
* Does all the loading of JS files
- *
- * @param q The queue to be loaded
- * @private
*/
var _load = function (q) {
@@ -349,12 +330,6 @@ var minion = (function (root) {
/**
* Used by minion.get() and minion.define().
* Get the namespace/Class, or creates it if it does not exist. Also optionally creates Objects in the specified namepsace.
- *
- * @param {String|Object}id The fully qualified namespace.
- * @param {Boolean} autoCreate Whether or not to create a blank object if the namespace does not yet exist.
- * @param {Object} [definitions] An object of class definitions which will be added to the namespace.
- * @returns {Object} The object that represents the fully qualified namespace passed in as the first argument.
- * @private
*/
var _namespace = function (id, autoCreate, definitions) {
@@ -449,9 +424,6 @@ var minion = (function (root) {
/**
* Configure minion.
- *
- * @public
- * @param {Object} configObj Configuration object, possible properties are : classPath, separator and fileSuffix
*/
_minion.configure = function (configObj) {
@@ -476,9 +448,6 @@ var minion = (function (root) {
/**
* Alias minion under a different namespace. I.e. var woot = minion.alias("woot");
- *
- * @public
- * @param {String} alias The name of the namespace to alias minion under.
*/
_minion.alias = function (alias) {
@@ -488,10 +457,6 @@ var minion = (function (root) {
/**
* Gets the object by it's fully qualified identifier.
- *
- * @public
- * @param {String} id The identifier to get
- * @returns {Object|Boolean} The object that represents the identifier or false if it has not yet been defined.
*/
_minion.get = function (id) {
@@ -514,11 +479,6 @@ var minion = (function (root) {
/**
* Defines Classes under the given namespace.
- *
- * @public
- * @param {String} id The namespace to define the Classes under.
- * @param {Object} [definitions] An object of class definitions which will be added to the namespace
- * @returns {Object} The object that represents the namespace passed in as the first argument.
*/
_minion.define = function (id, definitions) {
var r = _namespace(id, true, definitions);
@@ -528,10 +488,6 @@ var minion = (function (root) {
/**
* Gets the URL for a given identifier.
- *
- * @public
- * @param {String} id The fully qualified name to look up.
- * @returns {String} The URL of the file that maps to the fully qualified name.
*/
_minion.getURL = function (id) {
@@ -548,12 +504,8 @@ var minion = (function (root) {
};
/**
- * Checks to see whether the given fully qualified name or Object is defined as a minion class. (Checks for .__isDefined)<br>
+ * Checks to see whether the given fully qualified name or Object is defined as a minion class. (Checks for .__isDefined)
* NOTE: Classes that have not yet loaded all of their dependencies, will return FALSE for this check.
- *
- * @public
- * @param {String|Object} id The fully qualfied class name, or an Object.
- * @returns {Boolean} Whether or not this is defined.
*/
_minion.isDefined = function (id) {
@@ -563,11 +515,6 @@ var minion = (function (root) {
/**
* Extends a given class asynchronously.
- *
- * @public
- * @param {String} id The fully qualified name of the Class you want to extend.
- * @param {Object} obj A new Class Object
- * @returns {Object} The extended Class, or, if still waiting on dependencies, the original Object with a few more properties for internal minion use.
*/
_minion.extend = function (id, obj) {
@@ -588,10 +535,6 @@ var minion = (function (root) {
/**
* Tells minion that filePath provides the class definitions for these classes.
* Useful in cases where you group specific things into minfiied js files.
- *
- * @public
- * @param {String} file The path of a JS file.
- * @param {String|Array} definitions Fully qualfiied name(s) of class(es)
*/
_minion.provides = function (file, definitions) {
@@ -610,10 +553,6 @@ var minion = (function (root) {
/**
* Asyncrhonously loads in js files for the classes specified.
* If the classes have already been loaded, or are already defined, the callback function is invoked immediately.
- *
- * @public
- * @param {String|Array} ids The fully qualified name(s) of the class(es) to load.
- * @param {Function} callback The function to call once all classes (and their dependencies) have been loaded.
*/
_minion.require = function (ids, callback) {
@@ -664,11 +603,6 @@ var minion = (function (root) {
*
* Identifiers can contain the* wildcard character as its last segment (eg: test.*)
* which will import all Classes under the given namespace.
- *
- * @public
- * @param {String|Array} ids The fully qualfiied name(s) to import into the global namespace.
- * @param {Object=[root]} The scope to use.
- * @returns {Object} Returns the object passed in as the second argument, with the classes passed in as the first argument as properties.
*/
_minion.use = function (ids, scope) {
@@ -711,38 +645,38 @@ var minion = (function (root) {
return scope;
};
- /** @private */
+
_minion.enableNotifications = function () {
if (_minion.isDefined("minion.NotificationManager")) {
if (!_notificationManager) {
_notificationManager = new (minion.get("minion.NotificationManager"))();
- /** @private */
+
_minion.subscribe = function () {
_notificationManager.subscribe.apply(_notificationManager, arguments);
};
- /** @private */
+
_minion.unsubscribe = function () {
_notificationManager.unsubscribe.apply(_notificationManager, arguments);
};
- /** @private */
+
_minion.publish = function () {
_notificationManager.publish.apply(_notificationManager, arguments);
};
- /** @private */
+
_minion.holdNotification = function () {
_notificationManager.holdNotification.apply(_notificationManager, arguments);
};
- /** @private */
+
_minion.releaseNotification = function () {
_notificationManager.releaseNotification.apply(_notificationManager, arguments);
};
- /** @private */
+
_minion.cancelNotification = function () {
_notificationManager.cancelNotification.apply(_notificationManager, arguments);
};
View
12 lib/minion.node.js
@@ -0,0 +1,12 @@
+/*
+ Only included in the node.js version of minion. Provides the build() + watch() methods.
+ Can be called programatically or via the cli `minion build [options]`
+*/
+
+minion.build = function (opts, cb) {
+
+}
+
+minion.watch = function (opts, cb) {
+
+}
View
20 src/minion.notifications.js → lib/minion.notifications.js
@@ -4,8 +4,6 @@
minion.define("minion", {
- /** @lends minion.Notification# */
-
Notification : minion.extend("minion.Class", {
data : {},
@@ -19,11 +17,6 @@
*
* Notifications are the backbone of Minion's pub/sub model.
* You should not have to construct Notification's directly, as the publish() method does this for you.
- *
- * @constructs
- * @param {String} name The name of the Notification.
- * @param {Object} data An object of data associated with the Notification.
- * @param {Function} callback A callback function. This gets invoked by calling Notification.respond();
*/
init : function(name, data, callback) {
this.name = name;
@@ -34,18 +27,13 @@
/**
*
* Holds a notification. Useful if you want to do other things before other instances receive this Notification,
- *
- * @public
*/
hold : function() {
this.status = 2;
},
/**
- *
* Releases a Notification, call this at some point after hold();
- *
- * @public
*/
release : function() {
@@ -54,10 +42,7 @@
},
/**
- *
* Cancels a Notification, any instances interested in this Notification higher up the chain will not receive it.
- *
- * @public
*/
cancel : function() {
@@ -72,11 +57,7 @@
},
/**
- *
* Dispatches a Notification. You will rarely ever construct or call dispatch() on Notifications directly, as the publish() method handles all of this.
- *
- * @param {Object} obj An Object referencing what is dispatching this Notification.
- * @public
*/
dispatch : function(obj) {
@@ -109,7 +90,6 @@
/*
This Class handles all the nitty gritty Notification stuff.
- TODO: Be nice and add some comments for other people :)
*/
require : [
View
13 src/minion.singleton.js → lib/minion.singleton.js
@@ -1,25 +1,18 @@
- (function(){
+(function(){
"use strict";
minion.define("minion", {
- /** @lends minion.Singleton# */
-
Singleton : minion.extend("minion.Class", {
/**
- *
* A way to easily implement Singletons.
- *