Commit d0a418c3 authored by Arthur Verschaeve's avatar Arthur Verschaeve

PureMVC: new app UI & switch to npm for dependencies

* Included `todomvc-app-css`, this includes the new UI.
* Replaced bower by NPM.
* Include all files that aren't needed in the repo in the gitignore

Ref #1110
parent bc5391d3
node_modules/todomvc-app-css
!node_modules/todomvc-app-css/index.css
node_modules/todomvc-common
!node_modules/todomvc-common/base.js
!node_modules/todomvc-common/base.css
node_modules/npmvc
!node_modules/npmvc/lib/puremvc-1.0.1.js
node_modules/director
!node_modules/director/build/director.js
{
"name": "todomvc-puremvc",
"version": "0.0.0",
"dependencies": {
"puremvc": "~1.0.1",
"director": "~1.2.0",
"todomvc-common": "~0.3.0"
}
}
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>PureMVC • TodoMVC</title> <title>PureMVC • TodoMVC</title>
<link rel="stylesheet" href="bower_components/todomvc-common/base.css"> <link rel="stylesheet" href="node_modules/todomvc-common/base.css">
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
</head> </head>
<body> <body>
<section id="todoapp"> <section id="todoapp">
...@@ -40,13 +41,13 @@ ...@@ -40,13 +41,13 @@
</footer> </footer>
<!-- TODOMVC PROJECT BASE --> <!-- TODOMVC PROJECT BASE -->
<script src="bower_components/todomvc-common/base.js"></script> <script src="node_modules/todomvc-common/base.js"></script>
<!-- FLATIRION DIRECTOR ROUTING LIBRARY --> <!-- FLATIRION DIRECTOR ROUTING LIBRARY -->
<script src="bower_components/director/director.js"></script> <script src="node_modules/director/build/director.js"></script>
<!-- PUREMVC LIBRARY --> <!-- PUREMVC LIBRARY -->
<script src="bower_components/puremvc/puremvc-1.0.1.js"></script> <script src="node_modules/npmvc/lib/puremvc-1.0.1.js"></script>
<!-- APPLICATION CONSTANTS --> <!-- APPLICATION CONSTANTS -->
<script src="js/AppConstants.js"></script> <script src="js/AppConstants.js"></script>
......
// //
// Generated on Sun Dec 16 2012 22:47:05 GMT-0500 (EST) by Nodejitsu, Inc (Using Codesurgeon). // Generated on Tue Dec 16 2014 12:13:47 GMT+0100 (CET) by Charlie Robbins, Paolo Fragomeni & the Contributors (Using Codesurgeon).
// Version 1.1.9 // Version 1.2.6
// //
(function (exports) { (function (exports) {
/* /*
* browser.js: Browser specific functionality for director. * browser.js: Browser specific functionality for director.
* *
* (C) 2011, Nodejitsu Inc. * (C) 2011, Charlie Robbins, Paolo Fragomeni, & the Contributors.
* MIT LICENSE * MIT LICENSE
* *
*/ */
if (!Array.prototype.filter) {
Array.prototype.filter = function(filter, that) {
var other = [], v;
for (var i = 0, n = this.length; i < n; i++) {
if (i in this && filter.call(that, v = this[i], i, this)) {
other.push(v);
}
}
return other;
};
}
if (!Array.isArray){
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
}
var dloc = document.location; var dloc = document.location;
function dlocHashEmpty() { function dlocHashEmpty() {
...@@ -197,11 +178,12 @@ var Router = exports.Router = function (routes) { ...@@ -197,11 +178,12 @@ var Router = exports.Router = function (routes) {
}; };
Router.prototype.init = function (r) { Router.prototype.init = function (r) {
var self = this; var self = this
, routeTo;
this.handler = function(onChangeEvent) { this.handler = function(onChangeEvent) {
var newURL = onChangeEvent && onChangeEvent.newURL || window.location.hash; var newURL = onChangeEvent && onChangeEvent.newURL || window.location.hash;
var url = self.history === true ? self.getPath() : newURL.replace(/.*#/, ''); var url = self.history === true ? self.getPath() : newURL.replace(/.*#/, '');
self.dispatch('on', url); self.dispatch('on', url.charAt(0) === '/' ? url : '/' + url);
}; };
listener.init(this.handler, this.history); listener.init(this.handler, this.history);
...@@ -210,13 +192,20 @@ Router.prototype.init = function (r) { ...@@ -210,13 +192,20 @@ Router.prototype.init = function (r) {
if (dlocHashEmpty() && r) { if (dlocHashEmpty() && r) {
dloc.hash = r; dloc.hash = r;
} else if (!dlocHashEmpty()) { } else if (!dlocHashEmpty()) {
self.dispatch('on', dloc.hash.replace(/^#/, '')); self.dispatch('on', '/' + dloc.hash.replace(/^(#\/|#|\/)/, ''));
} }
} }
else { else {
var routeTo = dlocHashEmpty() && r ? r : !dlocHashEmpty() ? dloc.hash.replace(/^#/, '') : null; if (this.convert_hash_in_init) {
if (routeTo) { // Use hash as route
window.history.replaceState({}, document.title, routeTo); routeTo = dlocHashEmpty() && r ? r : !dlocHashEmpty() ? dloc.hash.replace(/^#/, '') : null;
if (routeTo) {
window.history.replaceState({}, document.title, routeTo);
}
}
else {
// Use canonical url
routeTo = this.getPath();
} }
// Router has been initialized, but due to the chrome bug it will not // Router has been initialized, but due to the chrome bug it will not
...@@ -352,7 +341,7 @@ function paramifyString(str, params, mod) { ...@@ -352,7 +341,7 @@ function paramifyString(str, params, mod) {
} }
} }
} }
return mod === str ? "([._a-zA-Z0-9-]+)" : mod; return mod === str ? "([._a-zA-Z0-9-%()]+)" : mod;
} }
function regifyString(str, params) { function regifyString(str, params) {
...@@ -363,11 +352,16 @@ function regifyString(str, params) { ...@@ -363,11 +352,16 @@ function regifyString(str, params) {
out += str.substr(0, matches.index) + matches[0]; out += str.substr(0, matches.index) + matches[0];
} }
str = out += str.substr(last); str = out += str.substr(last);
var captures = str.match(/:([^\/]+)/ig), length; var captures = str.match(/:([^\/]+)/ig), capture, length;
if (captures) { if (captures) {
length = captures.length; length = captures.length;
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
str = str.replace(captures[i], paramifyString(captures[i], params)); capture = captures[i];
if (capture.slice(0, 2) === "::") {
str = capture.slice(1);
} else {
str = str.replace(capture, paramifyString(capture, params));
}
} }
} }
return str; return str;
...@@ -393,6 +387,8 @@ function terminator(routes, delimiter, start, stop) { ...@@ -393,6 +387,8 @@ function terminator(routes, delimiter, start, stop) {
return routes; return routes;
} }
var QUERY_SEPARATOR = /\?.*/;
Router.prototype.configure = function(options) { Router.prototype.configure = function(options) {
options = options || {}; options = options || {};
for (var i = 0; i < this.methods.length; i++) { for (var i = 0; i < this.methods.length; i++) {
...@@ -406,6 +402,7 @@ Router.prototype.configure = function(options) { ...@@ -406,6 +402,7 @@ Router.prototype.configure = function(options) {
this.resource = options.resource; this.resource = options.resource;
this.history = options.html5history && this.historySupport || false; this.history = options.html5history && this.historySupport || false;
this.run_in_init = this.history === true && options.run_handler_in_init !== false; this.run_in_init = this.history === true && options.run_handler_in_init !== false;
this.convert_hash_in_init = this.history === true && options.convert_hash_in_init !== false;
this.every = { this.every = {
after: options.after || null, after: options.after || null,
before: options.before || null, before: options.before || null,
...@@ -422,6 +419,7 @@ Router.prototype.param = function(token, matcher) { ...@@ -422,6 +419,7 @@ Router.prototype.param = function(token, matcher) {
this.params[token] = function(str) { this.params[token] = function(str) {
return str.replace(compiled, matcher.source || matcher); return str.replace(compiled, matcher.source || matcher);
}; };
return this;
}; };
Router.prototype.on = Router.prototype.route = function(method, path, route) { Router.prototype.on = Router.prototype.route = function(method, path, route) {
...@@ -449,8 +447,20 @@ Router.prototype.on = Router.prototype.route = function(method, path, route) { ...@@ -449,8 +447,20 @@ Router.prototype.on = Router.prototype.route = function(method, path, route) {
this.insert(method, this.scope.concat(path), route); this.insert(method, this.scope.concat(path), route);
}; };
Router.prototype.path = function(path, routesFn) {
var self = this, length = this.scope.length;
if (path.source) {
path = path.source.replace(/\\\//ig, "/");
}
path = path.split(new RegExp(this.delimiter));
path = terminator(path, this.delimiter);
this.scope = this.scope.concat(path);
routesFn.call(this, this);
this.scope.splice(length, path.length);
};
Router.prototype.dispatch = function(method, path, callback) { Router.prototype.dispatch = function(method, path, callback) {
var self = this, fns = this.traverse(method, path, this.routes, ""), invoked = this._invoked, after; var self = this, fns = this.traverse(method, path.replace(QUERY_SEPARATOR, ""), this.routes, ""), invoked = this._invoked, after;
this._invoked = true; this._invoked = true;
if (!fns || fns.length === 0) { if (!fns || fns.length === 0) {
this.last = []; this.last = [];
...@@ -485,20 +495,22 @@ Router.prototype.dispatch = function(method, path, callback) { ...@@ -485,20 +495,22 @@ Router.prototype.dispatch = function(method, path, callback) {
Router.prototype.invoke = function(fns, thisArg, callback) { Router.prototype.invoke = function(fns, thisArg, callback) {
var self = this; var self = this;
var apply;
if (this.async) { if (this.async) {
_asyncEverySeries(fns, function apply(fn, next) { apply = function(fn, next) {
if (Array.isArray(fn)) { if (Array.isArray(fn)) {
return _asyncEverySeries(fn, apply, next); return _asyncEverySeries(fn, apply, next);
} else if (typeof fn == "function") { } else if (typeof fn == "function") {
fn.apply(thisArg, fns.captures.concat(next)); fn.apply(thisArg, (fns.captures || []).concat(next));
} }
}, function() { };
_asyncEverySeries(fns, apply, function() {
if (callback) { if (callback) {
callback.apply(thisArg, arguments); callback.apply(thisArg, arguments);
} }
}); });
} else { } else {
_every(fns, function apply(fn) { apply = function(fn) {
if (Array.isArray(fn)) { if (Array.isArray(fn)) {
return _every(fn, apply); return _every(fn, apply);
} else if (typeof fn === "function") { } else if (typeof fn === "function") {
...@@ -506,7 +518,8 @@ Router.prototype.invoke = function(fns, thisArg, callback) { ...@@ -506,7 +518,8 @@ Router.prototype.invoke = function(fns, thisArg, callback) {
} else if (typeof fn === "string" && self.resource) { } else if (typeof fn === "string" && self.resource) {
self.resource[fn].apply(thisArg, fns.captures || []); self.resource[fn].apply(thisArg, fns.captures || []);
} }
}); };
_every(fns, apply);
} }
}; };
...@@ -686,7 +699,7 @@ Router.prototype.mount = function(routes, path) { ...@@ -686,7 +699,7 @@ Router.prototype.mount = function(routes, path) {
function insertOrMount(route, local) { function insertOrMount(route, local) {
var rename = route, parts = route.split(self.delimiter), routeType = typeof routes[route], isRoute = parts[0] === "" || !self._methods[parts[0]], event = isRoute ? "on" : rename; var rename = route, parts = route.split(self.delimiter), routeType = typeof routes[route], isRoute = parts[0] === "" || !self._methods[parts[0]], event = isRoute ? "on" : rename;
if (isRoute) { if (isRoute) {
rename = rename.slice((rename.match(new RegExp(self.delimiter)) || [ "" ])[0].length); rename = rename.slice((rename.match(new RegExp("^" + self.delimiter)) || [ "" ])[0].length);
parts.shift(); parts.shift();
} }
if (isRoute && routeType === "object" && !Array.isArray(routes[route])) { if (isRoute && routeType === "object" && !Array.isArray(routes[route])) {
......
/** /**
* @fileOverview * @fileOverview
* PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* Reuse governed by Creative Commons Attribution 3.0 * Reuse governed by Creative Commons Attribution 3.0
* http://creativecommons.org/licenses/by/3.0/us/ * http://creativecommons.org/licenses/by/3.0/us/
* @author david.foley@puremvc.org * @author david.foley@puremvc.org
*/ */
(function (scope){ (function (scope){
if (null == scope) if (null == scope)
scope= window; scope= module.exports;
// if the global puremvc namespace already exists, turn back now // if the global puremvc namespace already exists, turn back now
if (scope.puremvc) if (scope.puremvc)
{ {
return; return;
} }
/* implementation begin */ /* implementation begin */
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Observer * @class puremvc.Observer
* *
* A base Observer implementation. * A base Observer implementation.
* *
* An Observer is an object that encapsulates information * An Observer is an object that encapsulates information
* about an interested object with a method that should * about an interested object with a method that should
* be called when a particular Notification is broadcast. * be called when a particular Notification is broadcast.
* *
* In PureMVC, the Observer class assumes these responsibilities: * In PureMVC, the Observer class assumes these responsibilities:
* *
* - Encapsulate the notification (callback) method of the interested object. * - Encapsulate the notification (callback) method of the interested object.
* - Encapsulate the notification context (this) of the interested object. * - Encapsulate the notification context (this) of the interested object.
* - Provide methods for setting the notification method and context. * - Provide methods for setting the notification method and context.
* - Provide a method for notifying the interested object. * - Provide a method for notifying the interested object.
* *
* *
* The notification method on the interested object should take * The notification method on the interested object should take
* one parameter of type Notification. * one parameter of type Notification.
* *
* *
* @param {Function} notifyMethod * @param {Function} notifyMethod
* the notification method of the interested object * the notification method of the interested object
* @param {Object} notifyContext * @param {Object} notifyContext
* the notification context of the interested object * the notification context of the interested object
* @constructor * @constructor
*/ */
...@@ -58,7 +58,7 @@ function Observer (notifyMethod, notifyContext) ...@@ -58,7 +58,7 @@ function Observer (notifyMethod, notifyContext)
/** /**
* Set the Observers notification method. * Set the Observers notification method.
* *
* The notification method should take one parameter of type Notification * The notification method should take one parameter of type Notification
* @param {Function} notifyMethod * @param {Function} notifyMethod
* the notification (callback) method of the interested object. * the notification (callback) method of the interested object.
...@@ -71,10 +71,10 @@ Observer.prototype.setNotifyMethod= function (notifyMethod) ...@@ -71,10 +71,10 @@ Observer.prototype.setNotifyMethod= function (notifyMethod)
/** /**
* Set the Observers notification context. * Set the Observers notification context.
* *
* @param {Object} notifyContext * @param {Object} notifyContext
* the notification context (this) of the interested object. * the notification context (this) of the interested object.
* *
* @return {void} * @return {void}
*/ */
Observer.prototype.setNotifyContext= function (notifyContext) Observer.prototype.setNotifyContext= function (notifyContext)
...@@ -84,7 +84,7 @@ Observer.prototype.setNotifyContext= function (notifyContext) ...@@ -84,7 +84,7 @@ Observer.prototype.setNotifyContext= function (notifyContext)
/** /**
* Get the Function that this Observer will invoke when it is notified. * Get the Function that this Observer will invoke when it is notified.
* *
* @private * @private
* @return {Function} * @return {Function}
*/ */
...@@ -95,7 +95,7 @@ Observer.prototype.getNotifyMethod= function () ...@@ -95,7 +95,7 @@ Observer.prototype.getNotifyMethod= function ()
/** /**
* Get the Object that will serve as the Observers callback execution context * Get the Object that will serve as the Observers callback execution context
* *
* @private * @private
* @return {Object} * @return {Object}
*/ */
...@@ -106,7 +106,7 @@ Observer.prototype.getNotifyContext= function () ...@@ -106,7 +106,7 @@ Observer.prototype.getNotifyContext= function ()
/** /**
* Notify the interested object. * Notify the interested object.
* *
* @param {puremvc.Notification} notification * @param {puremvc.Notification} notification
* The Notification to pass to the interested objects notification method * The Notification to pass to the interested objects notification method
* @return {void} * @return {void}
...@@ -118,9 +118,9 @@ Observer.prototype.notifyObserver= function (notification) ...@@ -118,9 +118,9 @@ Observer.prototype.notifyObserver= function (notification)
/** /**
* Compare an object to this Observers notification context. * Compare an object to this Observers notification context.
* *
* @param {Object} object * @param {Object} object
* *
* @return {boolean} * @return {boolean}
*/ */
Observer.prototype.compareNotifyContext= function (object) Observer.prototype.compareNotifyContext= function (object)
...@@ -130,7 +130,7 @@ Observer.prototype.compareNotifyContext= function (object) ...@@ -130,7 +130,7 @@ Observer.prototype.compareNotifyContext= function (object)
/** /**
* The Observers callback Function * The Observers callback Function
* *
* @private * @private
* @type {Function} * @type {Function}
*/ */
...@@ -143,39 +143,39 @@ Observer.prototype.notify= null; ...@@ -143,39 +143,39 @@ Observer.prototype.notify= null;
*/ */
Observer.prototype.context= null; Observer.prototype.context= null;
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Notification * @class puremvc.Notification
* *
* A base Notification implementation. * A base Notification implementation.
* *
* PureMVC does not rely upon underlying event models such as the one provided * PureMVC does not rely upon underlying event models such as the one provided
* with the DOM or other browser centric W3C event models. * with the DOM or other browser centric W3C event models.
* *
* The Observer Pattern as implemented within PureMVC exists to support * The Observer Pattern as implemented within PureMVC exists to support
* event-driven communication between the application and the actors of the MVC * event-driven communication between the application and the actors of the MVC
* triad. * triad.
* *
* Notifications are not meant to be a replacement for events in the browser. * Notifications are not meant to be a replacement for events in the browser.
* Generally, Mediator implementors place event listeners on their view * Generally, Mediator implementors place event listeners on their view
* components, which they then handle in the usual way. This may lead to the * components, which they then handle in the usual way. This may lead to the
* broadcast of Notifications to trigger commands or to communicate with other * broadcast of Notifications to trigger commands or to communicate with other
* Mediators. {@link puremvc.Proxy Proxy}, * Mediators. {@link puremvc.Proxy Proxy},
* {@link puremvc.SimpleCommand SimpleCommand} * {@link puremvc.SimpleCommand SimpleCommand}
* and {@link puremvc.MacroCommand MacroCommand} * and {@link puremvc.MacroCommand MacroCommand}
* instances communicate with each other and * instances communicate with each other and
* {@link puremvc.Mediator Mediator}s * {@link puremvc.Mediator Mediator}s
* by broadcasting Notifications. * by broadcasting Notifications.
* *
* A key difference between browser events and PureMVC Notifications is that * A key difference between browser events and PureMVC Notifications is that
* events follow the 'Chain of Responsibility' pattern, 'bubbling' up the * events follow the 'Chain of Responsibility' pattern, 'bubbling' up the
* display hierarchy until some parent component handles the event, while * display hierarchy until some parent component handles the event, while
* PureMVC Notification follow a 'Publish/Subscribe' pattern. PureMVC classes * PureMVC Notification follow a 'Publish/Subscribe' pattern. PureMVC classes
* need not be related to each other in a parent/child relationship in order to * need not be related to each other in a parent/child relationship in order to
* communicate with one another using Notifications. * communicate with one another using Notifications.
* *
* @constructor * @constructor
* @param {string} name * @param {string} name
* The Notification name * The Notification name
* @param {Object} [body] * @param {Object} [body]
...@@ -202,7 +202,7 @@ Notification.prototype.getName= function() ...@@ -202,7 +202,7 @@ Notification.prototype.getName= function()
}; };
/** /**
* Set this Notifications body. * Set this Notifications body.
* @param {Object} body * @param {Object} body
* @return {void} * @return {void}
*/ */
...@@ -234,7 +234,7 @@ Notification.prototype.setType= function(type) ...@@ -234,7 +234,7 @@ Notification.prototype.setType= function(type)
/** /**
* Get the type of the Notification instance. * Get the type of the Notification instance.
* *
* @return {Object} * @return {Object}
*/ */
Notification.prototype.getType= function() Notification.prototype.getType= function()
...@@ -279,41 +279,41 @@ Notification.prototype.type= null; ...@@ -279,41 +279,41 @@ Notification.prototype.type= null;
*/ */
Notification.prototype.body= null; Notification.prototype.body= null;
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Notifier * @class puremvc.Notifier
* *
* A Base Notifier implementation. * A Base Notifier implementation.
* *
* {@link puremvc.MacroCommand MacroCommand}, * {@link puremvc.MacroCommand MacroCommand},
* {@link puremvc.SimpleCommand SimpleCommand}, * {@link puremvc.SimpleCommand SimpleCommand},
* {@link puremvc.Mediator Mediator} and * {@link puremvc.Mediator Mediator} and
* {@link puremvc.Proxy Proxy} * {@link puremvc.Proxy Proxy}
* all have a need to send Notifications * all have a need to send Notifications
* *
* The Notifier interface provides a common method called #sendNotification that * The Notifier interface provides a common method called #sendNotification that
* relieves implementation code of the necessity to actually construct * relieves implementation code of the necessity to actually construct
* Notifications. * Notifications.
* *
* The Notifier class, which all of the above mentioned classes * The Notifier class, which all of the above mentioned classes
* extend, provides an initialized reference to the * extend, provides an initialized reference to the
* {@link puremvc.Facade Facade} * {@link puremvc.Facade Facade}
* Multiton, which is required for the convienience method * Multiton, which is required for the convienience method
* for sending Notifications but also eases implementation as these * for sending Notifications but also eases implementation as these
* classes have frequent * classes have frequent
* {@link puremvc.Facade Facade} interactions * {@link puremvc.Facade Facade} interactions
* and usually require access to the facade anyway. * and usually require access to the facade anyway.
* *
* NOTE: In the MultiCore version of the framework, there is one caveat to * NOTE: In the MultiCore version of the framework, there is one caveat to
* notifiers, they cannot send notifications or reach the facade until they * notifiers, they cannot send notifications or reach the facade until they
* have a valid multitonKey. * have a valid multitonKey.
* *
* The multitonKey is set: * The multitonKey is set:
* - on a Command when it is executed by the Controller * - on a Command when it is executed by the Controller
* - on a Mediator is registered with the View * - on a Mediator is registered with the View
* - on a Proxy is registered with the Model. * - on a Proxy is registered with the Model.
* *
* @constructor * @constructor
*/ */
function Notifier() function Notifier()
...@@ -323,9 +323,9 @@ function Notifier() ...@@ -323,9 +323,9 @@ function Notifier()
/** /**
* Create and send a Notification. * Create and send a Notification.
* *
* Keeps us from having to construct new Notification instances in our * Keeps us from having to construct new Notification instances in our
* implementation code. * implementation code.
* *
* @param {string} notificationName * @param {string} notificationName
* A notification name * A notification name
* @param {Object} [body] * @param {Object} [body]
...@@ -347,27 +347,27 @@ Notifier.prototype.sendNotification = function(notificationName, body, type) ...@@ -347,27 +347,27 @@ Notifier.prototype.sendNotification = function(notificationName, body, type)
/** /**
* @protected * @protected
* A reference to this Notifier's Facade. This reference will not be available * A reference to this Notifier's Facade. This reference will not be available
* until #initializeNotifier has been called. * until #initializeNotifier has been called.
* *
* @type {puremvc.Facade} * @type {puremvc.Facade}
*/ */
Notifier.prototype.facade; Notifier.prototype.facade;
/** /**
* Initialize this Notifier instance. * Initialize this Notifier instance.
* *
* This is how a Notifier gets its multitonKey. * This is how a Notifier gets its multitonKey.
* Calls to #sendNotification or to access the * Calls to #sendNotification or to access the
* facade will fail until after this method * facade will fail until after this method
* has been called. * has been called.
* *
* Mediators, Commands or Proxies may override * Mediators, Commands or Proxies may override
* this method in order to send notifications * this method in order to send notifications
* or access the Multiton Facade instance as * or access the Multiton Facade instance as
* soon as possible. They CANNOT access the facade * soon as possible. They CANNOT access the facade
* in their constructors, since this method will not * in their constructors, since this method will not
* yet have been called. * yet have been called.
* *
* *
* @param {string} key * @param {string} key
* The Notifiers multiton key; * The Notifiers multiton key;
...@@ -417,22 +417,22 @@ Notifier.prototype.multitonKey = null; ...@@ -417,22 +417,22 @@ Notifier.prototype.multitonKey = null;
*/ */
Notifier.MULTITON_MSG = "multitonKey for this Notifier not yet initialized!"; Notifier.MULTITON_MSG = "multitonKey for this Notifier not yet initialized!";
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.SimpleCommand * @class puremvc.SimpleCommand
* @extends puremvc.Notifier * @extends puremvc.Notifier
* *
* SimpleCommands encapsulate the business logic of your application. Your * SimpleCommands encapsulate the business logic of your application. Your
* subclass should override the #execute method where your business logic will * subclass should override the #execute method where your business logic will
* handle the * handle the
* {@link puremvc.Notification Notification} * {@link puremvc.Notification Notification}
* *
* Take a look at * Take a look at
* {@link puremvc.Facade#registerCommand Facade's registerCommand} * {@link puremvc.Facade#registerCommand Facade's registerCommand}
* or {@link puremvc.Controller#registerCommand Controllers registerCommand} * or {@link puremvc.Controller#registerCommand Controllers registerCommand}
* methods to see how to add commands to your application. * methods to see how to add commands to your application.
* *
* @constructor * @constructor
*/ */
function SimpleCommand () { }; function SimpleCommand () { };
...@@ -442,44 +442,44 @@ SimpleCommand.prototype.constructor= SimpleCommand; ...@@ -442,44 +442,44 @@ SimpleCommand.prototype.constructor= SimpleCommand;
/** /**
* Fulfill the use-case initiated by the given Notification * Fulfill the use-case initiated by the given Notification
* *
* In the Command Pattern, an application use-case typically begins with some * In the Command Pattern, an application use-case typically begins with some
* user action, which results in a Notification is handled by the business logic * user action, which results in a Notification is handled by the business logic
* in the #execute method of a command. * in the #execute method of a command.
* *
* @param {puremvc.Notification} notification * @param {puremvc.Notification} notification
* The notification to handle. * The notification to handle.
* @return {void} * @return {void}
*/ */
SimpleCommand.prototype.execute= function (notification) { }; SimpleCommand.prototype.execute= function (notification) { };
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.MacroCommand * @class puremvc.MacroCommand
* @extends puremvc.Notifier * @extends puremvc.Notifier
* *
* A base command implementation that executes other commands, such as * A base command implementation that executes other commands, such as
* {@link puremvc.SimpleCommand SimpleCommand} * {@link puremvc.SimpleCommand SimpleCommand}
* or {@link puremvc.MacroCommand MacroCommand} * or {@link puremvc.MacroCommand MacroCommand}
* subclasses. * subclasses.
* *
* A MacroCommand maintains an list of * A MacroCommand maintains an list of
* command constructor references called *SubCommands*. * command constructor references called *SubCommands*.
* *
* When #execute is called, the MacroCommand * When #execute is called, the MacroCommand
* instantiates and calls #execute on each of its *SubCommands* in turn. * instantiates and calls #execute on each of its *SubCommands* in turn.
* Each *SubCommand* will be passed a reference to the original * Each *SubCommand* will be passed a reference to the original
* {@link puremvc.Notification Notification} * {@link puremvc.Notification Notification}
* that was passed to the MacroCommands #execute method * that was passed to the MacroCommands #execute method
* *
* Unlike {@link puremvc.SimpleCommand SimpleCommand}, * Unlike {@link puremvc.SimpleCommand SimpleCommand},
* your subclass should not override #execute but instead, should * your subclass should not override #execute but instead, should
* override the #initializeMacroCommand method, calling #addSubCommand once for * override the #initializeMacroCommand method, calling #addSubCommand once for
* each *SubCommand* to be executed. * each *SubCommand* to be executed.
* *
* If your subclass does define a constructor, be sure to call "super" like so * If your subclass does define a constructor, be sure to call "super" like so
* *
* function MyMacroCommand () * function MyMacroCommand ()
* { * {
* MacroCommand.call(this); * MacroCommand.call(this);
...@@ -505,12 +505,12 @@ MacroCommand.prototype.subCommands= null; ...@@ -505,12 +505,12 @@ MacroCommand.prototype.subCommands= null;
/** /**
* @protected * @protected
* Initialize the MacroCommand. * Initialize the MacroCommand.
* *
* In your subclass, override this method to * In your subclass, override this method to
* initialize the MacroCommand's *SubCommand* * initialize the MacroCommand's *SubCommand*
* list with command class references like * list with command class references like
* this: * this:
* *
* // Initialize MyMacroCommand * // Initialize MyMacroCommand
* MyMacroCommand.prototype.initializeMacroCommand= function () * MyMacroCommand.prototype.initializeMacroCommand= function ()
* { * {
...@@ -518,7 +518,7 @@ MacroCommand.prototype.subCommands= null; ...@@ -518,7 +518,7 @@ MacroCommand.prototype.subCommands= null;
* this.addSubCommand( com.me.myapp.controller.SecondCommand ); * this.addSubCommand( com.me.myapp.controller.SecondCommand );
* this.addSubCommand( com.me.myapp.controller.ThirdCommand ); * this.addSubCommand( com.me.myapp.controller.ThirdCommand );
* }; * };
* *
* Note that *SubCommand*s may be any command implementor, * Note that *SubCommand*s may be any command implementor,
* MacroCommands or SimpleCommands are both acceptable. * MacroCommands or SimpleCommands are both acceptable.
* @return {void} * @return {void}
...@@ -528,7 +528,7 @@ MacroCommand.prototype.initializeMacroCommand= function() {} ...@@ -528,7 +528,7 @@ MacroCommand.prototype.initializeMacroCommand= function() {}
/** /**
* @protected * @protected
* Add a *SubCommand* * Add a *SubCommand*
* *
* The *SubCommand*s will be called in First In / First Out (FIFO) order * The *SubCommand*s will be called in First In / First Out (FIFO) order
* @param {Function} commandClassRef * @param {Function} commandClassRef
* A reference to a subclassed SimpleCommand or MacroCommand constructor * A reference to a subclassed SimpleCommand or MacroCommand constructor
...@@ -540,7 +540,7 @@ MacroCommand.prototype.addSubCommand= function(commandClassRef) ...@@ -540,7 +540,7 @@ MacroCommand.prototype.addSubCommand= function(commandClassRef)
/** /**
* Execute this MacroCommands *SubCommands* * Execute this MacroCommands *SubCommands*
* *
* The *SubCommand*s will be called in First In / First Out (FIFO) order * The *SubCommand*s will be called in First In / First Out (FIFO) order
* @param {puremvc.Notification} note * @param {puremvc.Notification} note
* The Notification object to be passed to each *SubCommand* * The Notification object to be passed to each *SubCommand*
...@@ -557,35 +557,35 @@ MacroCommand.prototype.execute= function(note) ...@@ -557,35 +557,35 @@ MacroCommand.prototype.execute= function(note)
} }
}; };
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Mediator * @class puremvc.Mediator
* @extends puremvc.Notifier * @extends puremvc.Notifier
* *
* A base Mediator implementation. * A base Mediator implementation.
* *
* In PureMVC, Mediator classes are used to mediate communication between a view * In PureMVC, Mediator classes are used to mediate communication between a view
* component and the rest of the application. * component and the rest of the application.
* *
* A Mediator should listen to its view components for events, and handle them * A Mediator should listen to its view components for events, and handle them
* by sending notifications (to be handled by other Mediators, * by sending notifications (to be handled by other Mediators,
* {@link puremvc.SimpleCommand SimpleCommands} * {@link puremvc.SimpleCommand SimpleCommands}
* or * or
* {@link puremvc.MacroCommand MacroCommands}) * {@link puremvc.MacroCommand MacroCommands})
* or passing data from the view component directly to a * or passing data from the view component directly to a
* {@link puremvc.Proxy Proxy}, such as submitting * {@link puremvc.Proxy Proxy}, such as submitting
* the contents of a form to a service. * the contents of a form to a service.
* *
* Mediators should not perform business logic, maintain state or other * Mediators should not perform business logic, maintain state or other
* information for its view component, or break the encapsulation of the view * information for its view component, or break the encapsulation of the view
* component by manipulating the view component's children. It should only call * component by manipulating the view component's children. It should only call
* methods or set properties on the view component. * methods or set properties on the view component.
* *
* The view component should encapsulate its own behavior and implementation by * The view component should encapsulate its own behavior and implementation by
* exposing methods and properties that the Mediator can call without having to * exposing methods and properties that the Mediator can call without having to
* know about the view component's children. * know about the view component's children.
* *
* @constructor * @constructor
* @param {string} [mediatorName] * @param {string} [mediatorName]
* The Mediators name. The Mediators static #NAME value is used by default * The Mediators name. The Mediators static #NAME value is used by default
...@@ -595,16 +595,16 @@ MacroCommand.prototype.execute= function(note) ...@@ -595,16 +595,16 @@ MacroCommand.prototype.execute= function(note)
function Mediator (mediatorName, viewComponent) function Mediator (mediatorName, viewComponent)
{ {
this.mediatorName= mediatorName || this.constructor.NAME; this.mediatorName= mediatorName || this.constructor.NAME;
this.viewComponent=viewComponent; this.viewComponent=viewComponent;
}; };
/** /**
* @static * @static
* The name of the Mediator. * The name of the Mediator.
* *
* Typically, a Mediator will be written to serve one specific control or group * Typically, a Mediator will be written to serve one specific control or group
* of controls and so, will not have a need to be dynamically named. * of controls and so, will not have a need to be dynamically named.
* *
* @type {string} * @type {string}
*/ */
Mediator.NAME= "Mediator"; Mediator.NAME= "Mediator";
...@@ -615,7 +615,7 @@ Mediator.prototype.constructor= Mediator; ...@@ -615,7 +615,7 @@ Mediator.prototype.constructor= Mediator;
/** /**
* Get the name of the Mediator * Get the name of the Mediator
* *
* @return {string} * @return {string}
* The Mediator name * The Mediator name
*/ */
...@@ -628,10 +628,10 @@ Mediator.prototype.getMediatorName= function () ...@@ -628,10 +628,10 @@ Mediator.prototype.getMediatorName= function ()
* Set the Mediators view component. This could * Set the Mediators view component. This could
* be a HTMLElement, a bespoke UiComponent wrapper * be a HTMLElement, a bespoke UiComponent wrapper
* class, a MooTools Element, a jQuery result or a * class, a MooTools Element, a jQuery result or a
* css selector, depending on which DOM abstraction * css selector, depending on which DOM abstraction
* library you are using. * library you are using.
* *
* *
* @param {Object} the view component * @param {Object} the view component
* @return {void} * @return {void}
*/ */
...@@ -642,21 +642,21 @@ Mediator.prototype.setViewComponent= function (viewComponent) ...@@ -642,21 +642,21 @@ Mediator.prototype.setViewComponent= function (viewComponent)
/** /**
* Get the Mediators view component. * Get the Mediators view component.
* *
* Additionally, an optional explicit getter can be * Additionally, an optional explicit getter can be
* be defined in the subclass that defines the * be defined in the subclass that defines the
* view components, providing a more semantic interface * view components, providing a more semantic interface
* to the Mediator. * to the Mediator.
* *
* This is different from the AS3 implementation in * This is different from the AS3 implementation in
* the sense that no casting is required from the * the sense that no casting is required from the
* object supplied as the view component. * object supplied as the view component.
* *
* MyMediator.prototype.getComboBox= function () * MyMediator.prototype.getComboBox= function ()
* { * {
* return this.viewComponent; * return this.viewComponent;
* } * }
* *
* @return {Object} * @return {Object}
* The view component * The view component
*/ */
...@@ -668,8 +668,8 @@ Mediator.prototype.getViewComponent= function () ...@@ -668,8 +668,8 @@ Mediator.prototype.getViewComponent= function ()
/** /**
* List the Notification names this Mediator is interested * List the Notification names this Mediator is interested
* in being notified of. * in being notified of.
* *
* @return {Array} * @return {Array}
* The list of Notification names. * The list of Notification names.
*/ */
Mediator.prototype.listNotificationInterests= function () Mediator.prototype.listNotificationInterests= function ()
...@@ -679,11 +679,11 @@ Mediator.prototype.listNotificationInterests= function () ...@@ -679,11 +679,11 @@ Mediator.prototype.listNotificationInterests= function ()
/** /**
* Handle Notifications. * Handle Notifications.
* *
* Typically this will be handled in a switch statement * Typically this will be handled in a switch statement
* with one 'case' entry per Notification the Mediator * with one 'case' entry per Notification the Mediator
* is interested in * is interested in
* *
* @param {puremvc.Notification} notification * @param {puremvc.Notification} notification
* @return {void} * @return {void}
*/ */
...@@ -712,7 +712,7 @@ Mediator.prototype.onRemove= function () ...@@ -712,7 +712,7 @@ Mediator.prototype.onRemove= function ()
/** /**
* @ignore * @ignore
* The Mediators name. Should only be accessed by Mediator subclasses. * The Mediators name. Should only be accessed by Mediator subclasses.
* *
* @protected * @protected
* @type string * @type string
*/ */
...@@ -721,35 +721,35 @@ Mediator.prototype.mediatorName= null; ...@@ -721,35 +721,35 @@ Mediator.prototype.mediatorName= null;
/** /**
* @ignore * @ignore
* The Mediators viewComponent. Should only be accessed by Mediator subclasses. * The Mediators viewComponent. Should only be accessed by Mediator subclasses.
* *
* @protected * @protected
* @type Object * @type Object
*/ */
Mediator.prototype.viewComponent=null; Mediator.prototype.viewComponent=null;
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Proxy * @class puremvc.Proxy
* @extends puremvc.Notifier * @extends puremvc.Notifier
* *
* A base Proxy implementation. * A base Proxy implementation.
* *
* In PureMVC, Proxy classes are used to manage parts of the application's data * In PureMVC, Proxy classes are used to manage parts of the application's data
* model. * model.
* *
* A Proxy might simply manage a reference to a local data object, in which case * A Proxy might simply manage a reference to a local data object, in which case
* interacting with it might involve setting and getting of its data in * interacting with it might involve setting and getting of its data in
* synchronous fashion. * synchronous fashion.
* *
* Proxy classes are also used to encapsulate the application's interaction with * Proxy classes are also used to encapsulate the application's interaction with
* remote services to save or retrieve data, in which case, we adopt an * remote services to save or retrieve data, in which case, we adopt an
* asyncronous idiom; setting data (or calling a method) on the Proxy and * asyncronous idiom; setting data (or calling a method) on the Proxy and
* listening for a * listening for a
* {@link puremvc.Notification Notification} * {@link puremvc.Notification Notification}
* to be sent when the Proxy has retrieved the data from the service. * to be sent when the Proxy has retrieved the data from the service.
* *
* *
* @param {string} [proxyName] * @param {string} [proxyName]
* The Proxy's name. If none is provided, the Proxy will use its constructors * The Proxy's name. If none is provided, the Proxy will use its constructors
* NAME property. * NAME property.
...@@ -817,7 +817,7 @@ Proxy.prototype.onRegister= function() ...@@ -817,7 +817,7 @@ Proxy.prototype.onRegister= function()
/** /**
* Called by the {@link puremvc.Model Model} when * Called by the {@link puremvc.Model Model} when
* the Proxy is removed. * the Proxy is removed.
* *
* @return {void} * @return {void}
*/ */
Proxy.prototype.onRemove= function() Proxy.prototype.onRemove= function()
...@@ -843,21 +843,21 @@ Proxy.prototype.proxyName= null; ...@@ -843,21 +843,21 @@ Proxy.prototype.proxyName= null;
*/ */
Proxy.prototype.data= null; Proxy.prototype.data= null;
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Facade * @class puremvc.Facade
* Facade exposes the functionality of the Controller, Model and View * Facade exposes the functionality of the Controller, Model and View
* actors to client facing code. * actors to client facing code.
* *
* This Facade implementation is a Multiton, so you should not call the * This Facade implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static Factory method, * constructor directly, but instead call the static Factory method,
* passing the unique key for this instance to #getInstance * passing the unique key for this instance to #getInstance
* *
* @constructor * @constructor
* @param {string} key * @param {string} key
* The multiton key to use to retrieve the Facade instance. * The multiton key to use to retrieve the Facade instance.
* @throws {Error} * @throws {Error}
* If an attempt is made to instantiate Facade directly * If an attempt is made to instantiate Facade directly
*/ */
function Facade(key) function Facade(key)
...@@ -874,11 +874,11 @@ function Facade(key) ...@@ -874,11 +874,11 @@ function Facade(key)
/** /**
* Initialize the Multiton Facade instance. * Initialize the Multiton Facade instance.
* *
* Called automatically by the constructor. Override in your subclass to any * Called automatically by the constructor. Override in your subclass to any
* subclass specific initializations. Be sure to call the 'super' * subclass specific initializations. Be sure to call the 'super'
* initializeFacade method, though * initializeFacade method, though
* *
* MyFacade.prototype.initializeFacade= function () * MyFacade.prototype.initializeFacade= function ()
* { * {
* Facade.call(this); * Facade.call(this);
...@@ -894,10 +894,10 @@ Facade.prototype.initializeFacade = function() ...@@ -894,10 +894,10 @@ Facade.prototype.initializeFacade = function()
}; };
/** /**
* Facade Multiton Factory method. * Facade Multiton Factory method.
* Note that this method will return null if supplied a * Note that this method will return null if supplied a
* null or undefined multiton key. * null or undefined multiton key.
* *
* @param {string} key * @param {string} key
* The multiton key use to retrieve a particular Facade instance * The multiton key use to retrieve a particular Facade instance
* @return {puremvc.Facade} * @return {puremvc.Facade}
...@@ -906,7 +906,7 @@ Facade.getInstance = function(key) ...@@ -906,7 +906,7 @@ Facade.getInstance = function(key)
{ {
if (null == key) if (null == key)
return null; return null;
if(Facade.instanceMap[key] == null) if(Facade.instanceMap[key] == null)
{ {
Facade.instanceMap[key] = new Facade(key); Facade.instanceMap[key] = new Facade(key);
...@@ -917,28 +917,28 @@ Facade.getInstance = function(key) ...@@ -917,28 +917,28 @@ Facade.getInstance = function(key)
/** /**
* Initialize the {@link puremvc.Controller Controller}. * Initialize the {@link puremvc.Controller Controller}.
* *
* Called by the #initializeFacade method. * Called by the #initializeFacade method.
* *
* Override this method in your subclass of Facade * Override this method in your subclass of Facade
* if one or both of the following are true: * if one or both of the following are true:
* - You wish to initialize a different Controller * - You wish to initialize a different Controller
* - You have * - You have
* {@link puremvc.SimpleCommand SimpleCommand}s * {@link puremvc.SimpleCommand SimpleCommand}s
* or {@link puremvc.MacroCommand MacroCommand}s * or {@link puremvc.MacroCommand MacroCommand}s
* to register with the Controllerat startup. * to register with the Controllerat startup.
* *
* If you don't want to initialize a different Controller, * If you don't want to initialize a different Controller,
* call the 'super' initializeControlle method at the beginning of your * call the 'super' initializeControlle method at the beginning of your
* method, then register commands. * method, then register commands.
* *
* MyFacade.prototype.initializeController= function () * MyFacade.prototype.initializeController= function ()
* { * {
* Facade.prototype.initializeController.call(this); * Facade.prototype.initializeController.call(this);
* this.registerCommand(AppConstants.A_NOTE_NAME, ABespokeCommand) * this.registerCommand(AppConstants.A_NOTE_NAME, ABespokeCommand)
* } * }
* *
* @protected * @protected
* @return {void} * @return {void}
*/ */
...@@ -953,27 +953,27 @@ Facade.prototype.initializeController = function() ...@@ -953,27 +953,27 @@ Facade.prototype.initializeController = function()
/** /**
* @protected * @protected
* Initialize the {@link puremvc.Model Model}; * Initialize the {@link puremvc.Model Model};
* *
* Called by the #initializeFacade method. * Called by the #initializeFacade method.
* Override this method in your subclass of Facade if one of the following are * Override this method in your subclass of Facade if one of the following are
* true: * true:
* *
* - You wish to initialize a different Model. * - You wish to initialize a different Model.
* *
* - You have {@link puremvc.Proxy Proxy}s to * - You have {@link puremvc.Proxy Proxy}s to
* register with the Model that do not retrieve a reference to the Facade at * register with the Model that do not retrieve a reference to the Facade at
* construction time. * construction time.
* *
* If you don't want to initialize a different Model * If you don't want to initialize a different Model
* call 'super' #initializeModel at the beginning of your method, then register * call 'super' #initializeModel at the beginning of your method, then register
* Proxys. * Proxys.
* *
* Note: This method is *rarely* overridden; in practice you are more * Note: This method is *rarely* overridden; in practice you are more
* likely to use a command to create and registerProxys with the Model>, * likely to use a command to create and registerProxys with the Model>,
* since Proxys with mutable data will likely * since Proxys with mutable data will likely
* need to send Notifications and thus will likely want to fetch a reference to * need to send Notifications and thus will likely want to fetch a reference to
* the Facade during their construction. * the Facade during their construction.
* *
* @return {void} * @return {void}
*/ */
Facade.prototype.initializeModel = function() Facade.prototype.initializeModel = function()
...@@ -986,32 +986,32 @@ Facade.prototype.initializeModel = function() ...@@ -986,32 +986,32 @@ Facade.prototype.initializeModel = function()
/** /**
* @protected * @protected
* *
* Initialize the {@link puremvc.View View}. * Initialize the {@link puremvc.View View}.
* *
* Called by the #initializeFacade method. * Called by the #initializeFacade method.
* *
* Override this method in your subclass of Facade if one or both of the * Override this method in your subclass of Facade if one or both of the
* following are true: * following are true:
* *
* - You wish to initialize a different View. * - You wish to initialize a different View.
* - You have Observers to register with the View * - You have Observers to register with the View
* *
* If you don't want to initialize a different View * If you don't want to initialize a different View
* call 'super' #initializeView at the beginning of your * call 'super' #initializeView at the beginning of your
* method, then register Mediator instances. * method, then register Mediator instances.
* *
* MyFacade.prototype.initializeView= function () * MyFacade.prototype.initializeView= function ()
* { * {
* Facade.prototype.initializeView.call(this); * Facade.prototype.initializeView.call(this);
* this.registerMediator(new MyMediator()); * this.registerMediator(new MyMediator());
* }; * };
* *
* Note: This method is *rarely* overridden; in practice you are more * Note: This method is *rarely* overridden; in practice you are more
* likely to use a command to create and register Mediators * likely to use a command to create and register Mediators
* with the View, since Mediator instances will need to send * with the View, since Mediator instances will need to send
* Notifications and thus will likely want to fetch a reference * Notifications and thus will likely want to fetch a reference
* to the Facade during their construction. * to the Facade during their construction.
* @return {void} * @return {void}
*/ */
Facade.prototype.initializeView = function() Facade.prototype.initializeView = function()
...@@ -1049,7 +1049,7 @@ Facade.prototype.removeCommand = function(notificationName) ...@@ -1049,7 +1049,7 @@ Facade.prototype.removeCommand = function(notificationName)
/** /**
* Check if a command is registered for a given notification. * Check if a command is registered for a given notification.
* *
* @param {string} notificationName * @param {string} notificationName
* A Notification name * A Notification name
* @return {boolean} * @return {boolean}
...@@ -1063,7 +1063,7 @@ Facade.prototype.hasCommand = function(notificationName) ...@@ -1063,7 +1063,7 @@ Facade.prototype.hasCommand = function(notificationName)
/** /**
* Register a Proxy with the {@link puremvc.Model#registerProxy Model} * Register a Proxy with the {@link puremvc.Model#registerProxy Model}
* by name. * by name.
* *
* @param {puremvc.Proxy} proxy * @param {puremvc.Proxy} proxy
* The Proxy instance to be registered with the Model. * The Proxy instance to be registered with the Model.
* @return {void} * @return {void}
...@@ -1075,7 +1075,7 @@ Facade.prototype.registerProxy = function(proxy) ...@@ -1075,7 +1075,7 @@ Facade.prototype.registerProxy = function(proxy)
/** /**
* Retrieve a Proxy from the Model * Retrieve a Proxy from the Model
* *
* @param {string} proxyName * @param {string} proxyName
* @return {puremvc.Proxy} * @return {puremvc.Proxy}
*/ */
...@@ -1116,7 +1116,7 @@ Facade.prototype.hasProxy = function(proxyName) ...@@ -1116,7 +1116,7 @@ Facade.prototype.hasProxy = function(proxyName)
/** /**
* Register a Mediator with with the View. * Register a Mediator with with the View.
* *
* @param {puremvc.Mediator} mediator * @param {puremvc.Mediator} mediator
* A reference to the Mediator to register * A reference to the Mediator to register
* @return {void} * @return {void}
...@@ -1131,7 +1131,7 @@ Facade.prototype.registerMediator = function(mediator) ...@@ -1131,7 +1131,7 @@ Facade.prototype.registerMediator = function(mediator)
/** /**
* Retrieve a Mediator from the View by name * Retrieve a Mediator from the View by name
* *
* @param {string} mediatorName * @param {string} mediatorName
* The Mediators name * The Mediators name
* @return {puremvc.Mediator} * @return {puremvc.Mediator}
...@@ -1144,7 +1144,7 @@ Facade.prototype.retrieveMediator = function(mediatorName) ...@@ -1144,7 +1144,7 @@ Facade.prototype.retrieveMediator = function(mediatorName)
/** /**
* Remove a Mediator from the View. * Remove a Mediator from the View.
* *
* @param {string} mediatorName * @param {string} mediatorName
* The name of the Mediator to remove. * The name of the Mediator to remove.
* @return {puremvc.Mediator} * @return {puremvc.Mediator}
...@@ -1163,7 +1163,7 @@ Facade.prototype.removeMediator = function(mediatorName) ...@@ -1163,7 +1163,7 @@ Facade.prototype.removeMediator = function(mediatorName)
/** /**
* Check if a Mediator is registered or not. * Check if a Mediator is registered or not.
* *
* @param {string} mediatorName * @param {string} mediatorName
* A Mediator name * A Mediator name
* @return {boolean} * @return {boolean}
...@@ -1175,12 +1175,12 @@ Facade.prototype.hasMediator = function(mediatorName) ...@@ -1175,12 +1175,12 @@ Facade.prototype.hasMediator = function(mediatorName)
}; };
/** /**
* Create and send a * Create and send a
* {@link puremvc.Notification Notification} * {@link puremvc.Notification Notification}
* *
* Keeps us from having to construct new Notification instances in our * Keeps us from having to construct new Notification instances in our
* implementation * implementation
* *
* @param {string} notificationName * @param {string} notificationName
* The name of the Notification to send * The name of the Notification to send
* @param {Object} [body] * @param {Object} [body]
...@@ -1196,13 +1196,13 @@ Facade.prototype.sendNotification = function(notificationName, body, type) ...@@ -1196,13 +1196,13 @@ Facade.prototype.sendNotification = function(notificationName, body, type)
/** /**
* Notify {@link puremvc.Observer Observer}s * Notify {@link puremvc.Observer Observer}s
* *
* This method is left public mostly for backward compatibility, and to allow * This method is left public mostly for backward compatibility, and to allow
* you to send custom notification classes using the facade. * you to send custom notification classes using the facade.
* *
* Usually you should just call sendNotification and pass the parameters, never * Usually you should just call sendNotification and pass the parameters, never
* having to construct the notification yourself. * having to construct the notification yourself.
* *
* @param {puremvc.Notification} notification * @param {puremvc.Notification} notification
* The Notification to send * The Notification to send
* @return {void} * @return {void}
...@@ -1216,12 +1216,12 @@ Facade.prototype.notifyObservers = function(notification) ...@@ -1216,12 +1216,12 @@ Facade.prototype.notifyObservers = function(notification)
}; };
/** /**
* Initialize the Facades Notifier capabilities by setting the Multiton key for * Initialize the Facades Notifier capabilities by setting the Multiton key for
* this facade instance. * this facade instance.
* *
* Not called directly, but instead from the constructor when #getInstance is * Not called directly, but instead from the constructor when #getInstance is
* invoked. It is necessary to be public in order to implement Notifier * invoked. It is necessary to be public in order to implement Notifier
* *
* @param {string} key * @param {string} key
* @return {void} * @return {void}
*/ */
...@@ -1245,8 +1245,8 @@ Facade.hasCore = function(key) ...@@ -1245,8 +1245,8 @@ Facade.hasCore = function(key)
}; };
/** /**
* Remove a *Core* * Remove a *Core*
* *
* Remove the Model, View, Controller and Facade for a given key. * Remove the Model, View, Controller and Facade for a given key.
* *
* @static * @static
...@@ -1319,42 +1319,42 @@ Facade.instanceMap = []; ...@@ -1319,42 +1319,42 @@ Facade.instanceMap = [];
*/ */
Facade.MULTITON_MSG = "Facade instance for this Multiton key already constructed!"; Facade.MULTITON_MSG = "Facade instance for this Multiton key already constructed!";
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.View * @class puremvc.View
* *
* A Multiton View implementation. * A Multiton View implementation.
* *
* In PureMVC, the View class assumes these responsibilities * In PureMVC, the View class assumes these responsibilities
* *
* - Maintain a cache of {@link puremvc.Mediator Mediator} * - Maintain a cache of {@link puremvc.Mediator Mediator}
* instances. * instances.
* *
* - Provide methods for registering, retrieving, and removing * - Provide methods for registering, retrieving, and removing
* {@link puremvc.Mediator Mediator}. * {@link puremvc.Mediator Mediator}.
* *
* - Notifiying {@link puremvc.Mediator Mediator} when they are registered or * - Notifiying {@link puremvc.Mediator Mediator} when they are registered or
* removed. * removed.
* *
* - Managing the observer lists for each {@link puremvc.Notification Notification} * - Managing the observer lists for each {@link puremvc.Notification Notification}
* in the application. * in the application.
* *
* - Providing a method for attaching {@link puremvc.Observer Observer} to an * - Providing a method for attaching {@link puremvc.Observer Observer} to an
* {@link puremvc.Notification Notification}'s observer list. * {@link puremvc.Notification Notification}'s observer list.
* *
* - Providing a method for broadcasting a {@link puremvc.Notification Notification}. * - Providing a method for broadcasting a {@link puremvc.Notification Notification}.
* *
* - Notifying the {@link puremvc.Observer Observer}s of a given * - Notifying the {@link puremvc.Observer Observer}s of a given
* {@link puremvc.Notification Notification} when it broadcast. * {@link puremvc.Notification Notification} when it broadcast.
* *
* This View implementation is a Multiton, so you should not call the * This View implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static Multiton * constructor directly, but instead call the static Multiton
* Factory #getInstance method. * Factory #getInstance method.
* *
* @param {string} key * @param {string} key
* @constructor * @constructor
* @throws {Error} * @throws {Error}
* if instance for this Multiton key has already been constructed * if instance for this Multiton key has already been constructed
*/ */
function View(key) function View(key)
...@@ -1374,11 +1374,11 @@ function View(key) ...@@ -1374,11 +1374,11 @@ function View(key)
/** /**
* @protected * @protected
* Initialize the Singleton View instance * Initialize the Singleton View instance
* *
* Called automatically by the constructor, this is your opportunity to * Called automatically by the constructor, this is your opportunity to
* initialize the Singleton instance in your subclass without overriding the * initialize the Singleton instance in your subclass without overriding the
* constructor * constructor
* *
* @return {void} * @return {void}
*/ */
View.prototype.initializeView = function() View.prototype.initializeView = function()
...@@ -1388,9 +1388,9 @@ View.prototype.initializeView = function() ...@@ -1388,9 +1388,9 @@ View.prototype.initializeView = function()
/** /**
* View Singleton Factory method. * View Singleton Factory method.
* Note that this method will return null if supplied a null * Note that this method will return null if supplied a null
* or undefined multiton key. * or undefined multiton key.
* *
* @return {puremvc.View} * @return {puremvc.View}
* The Singleton instance of View * The Singleton instance of View
*/ */
...@@ -1398,7 +1398,7 @@ View.getInstance = function(key) ...@@ -1398,7 +1398,7 @@ View.getInstance = function(key)
{ {
if (null == key) if (null == key)
return null; return null;
if(View.instanceMap[key] == null) if(View.instanceMap[key] == null)
{ {
View.instanceMap[key] = new View(key); View.instanceMap[key] = new View(key);
...@@ -1409,7 +1409,7 @@ View.getInstance = function(key) ...@@ -1409,7 +1409,7 @@ View.getInstance = function(key)
/** /**
* Register an Observer to be notified of Notifications with a given name * Register an Observer to be notified of Notifications with a given name
* *
* @param {string} notificationName * @param {string} notificationName
* The name of the Notifications to notify this Observer of * The name of the Notifications to notify this Observer of
* @param {puremvc.Observer} observer * @param {puremvc.Observer} observer
...@@ -1430,11 +1430,11 @@ View.prototype.registerObserver = function(notificationName, observer) ...@@ -1430,11 +1430,11 @@ View.prototype.registerObserver = function(notificationName, observer)
/** /**
* Notify the Observersfor a particular Notification. * Notify the Observersfor a particular Notification.
* *
* All previously attached Observers for this Notification's * All previously attached Observers for this Notification's
* list are notified and are passed a reference to the INotification in * list are notified and are passed a reference to the INotification in
* the order in which they were registered. * the order in which they were registered.
* *
* @param {puremvc.Notification} notification * @param {puremvc.Notification} notification
* The Notification to notify Observers of * The Notification to notify Observers of
* @return {void} * @return {void}
...@@ -1463,7 +1463,7 @@ View.prototype.notifyObservers = function(notification) ...@@ -1463,7 +1463,7 @@ View.prototype.notifyObservers = function(notification)
/** /**
* Remove the Observer for a given notifyContext from an observer list for * Remove the Observer for a given notifyContext from an observer list for
* a given Notification name * a given Notification name
* *
* @param {string} notificationName * @param {string} notificationName
* Which observer list to remove from * Which observer list to remove from
* @param {Object} notifyContext * @param {Object} notifyContext
...@@ -1491,19 +1491,19 @@ View.prototype.removeObserver = function(notificationName, notifyContext) ...@@ -1491,19 +1491,19 @@ View.prototype.removeObserver = function(notificationName, notifyContext)
/** /**
* Register a Mediator instance with the View. * Register a Mediator instance with the View.
* *
* Registers the Mediator so that it can be retrieved by name, * Registers the Mediator so that it can be retrieved by name,
* and further interrogates the Mediator for its * and further interrogates the Mediator for its
* {@link puremvc.Mediator#listNotificationInterests interests}. * {@link puremvc.Mediator#listNotificationInterests interests}.
* *
* If the Mediator returns any Notification * If the Mediator returns any Notification
* names to be notified about, an Observer is created encapsulating * names to be notified about, an Observer is created encapsulating
* the Mediator instance's * the Mediator instance's
* {@link puremvc.Mediator#handleNotification handleNotification} * {@link puremvc.Mediator#handleNotification handleNotification}
* method and registering it as an Observer for all Notifications the * method and registering it as an Observer for all Notifications the
* Mediator is interested in. * Mediator is interested in.
* *
* @param {puremvc.Mediator} * @param {puremvc.Mediator}
* a reference to the Mediator instance * a reference to the Mediator instance
*/ */
View.prototype.registerMediator = function(mediator) View.prototype.registerMediator = function(mediator)
...@@ -1536,7 +1536,7 @@ View.prototype.registerMediator = function(mediator) ...@@ -1536,7 +1536,7 @@ View.prototype.registerMediator = function(mediator)
/** /**
* Retrieve a Mediator from the View * Retrieve a Mediator from the View
* *
* @param {string} mediatorName * @param {string} mediatorName
* The name of the Mediator instance to retrieve * The name of the Mediator instance to retrieve
* @return {puremvc.Mediator} * @return {puremvc.Mediator}
...@@ -1549,7 +1549,7 @@ View.prototype.retrieveMediator = function(mediatorName) ...@@ -1549,7 +1549,7 @@ View.prototype.retrieveMediator = function(mediatorName)
/** /**
* Remove a Mediator from the View. * Remove a Mediator from the View.
* *
* @param {string} mediatorName * @param {string} mediatorName
* Name of the Mediator instance to be removed * Name of the Mediator instance to be removed
* @return {puremvc.Mediator} * @return {puremvc.Mediator}
...@@ -1581,7 +1581,7 @@ View.prototype.removeMediator = function(mediatorName) ...@@ -1581,7 +1581,7 @@ View.prototype.removeMediator = function(mediatorName)
/** /**
* Check if a Mediator is registered or not. * Check if a Mediator is registered or not.
* *
* @param {string} mediatorName * @param {string} mediatorName
* @return {boolean} * @return {boolean}
* Whether a Mediator is registered with the given mediatorname * Whether a Mediator is registered with the given mediatorname
...@@ -1593,7 +1593,7 @@ View.prototype.hasMediator = function(mediatorName) ...@@ -1593,7 +1593,7 @@ View.prototype.hasMediator = function(mediatorName)
/** /**
* Remove a View instance * Remove a View instance
* *
* @return {void} * @return {void}
*/ */
View.removeView = function(key) View.removeView = function(key)
...@@ -1648,9 +1648,9 @@ View.prototype.multitonKey = null; ...@@ -1648,9 +1648,9 @@ View.prototype.multitonKey = null;
*/ */
View.MULTITON_MSG = "View instance for this Multiton key already constructed!"; View.MULTITON_MSG = "View instance for this Multiton key already constructed!";
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Model * @class puremvc.Model
* *
* A Multiton Model implementation. * A Multiton Model implementation.
...@@ -1665,18 +1665,18 @@ View.MULTITON_MSG = "View instance for this Multiton key already constructed!"; ...@@ -1665,18 +1665,18 @@ View.MULTITON_MSG = "View instance for this Multiton key already constructed!";
* - Provide methods for registering, retrieving, and removing * - Provide methods for registering, retrieving, and removing
* {@link puremvc.Proxy Proxy} instances. * {@link puremvc.Proxy Proxy} instances.
* *
* Your application must register * Your application must register
* {@link puremvc.Proxy Proxy} instances with the Model. * {@link puremvc.Proxy Proxy} instances with the Model.
* Typically, you use a * Typically, you use a
* {@link puremvc.SimpleCommand SimpleCommand} * {@link puremvc.SimpleCommand SimpleCommand}
* or * or
* {@link puremvc.MacroCommand MacroCommand} * {@link puremvc.MacroCommand MacroCommand}
* to create and register Proxy instances once the Facade has initialized the * to create and register Proxy instances once the Facade has initialized the
* *Core* actors. * *Core* actors.
* *
* This Model implementation is a Multiton, so you should not call the * This Model implementation is a Multiton, so you should not call the
* constructor directly, but instead call the * constructor directly, but instead call the
* {@link #getInstance static Multiton Factory method} * {@link #getInstance static Multiton Factory method}
* @constructor * @constructor
* @param {string} key * @param {string} key
* The Models multiton key * The Models multiton key
...@@ -1698,12 +1698,12 @@ function Model(key) ...@@ -1698,12 +1698,12 @@ function Model(key)
/** /**
* Initialize the Model instance. * Initialize the Model instance.
* *
* Called automatically by the constructor, this * Called automatically by the constructor, this
* is your opportunity to initialize the Singleton * is your opportunity to initialize the Singleton
* instance in your subclass without overriding the * instance in your subclass without overriding the
* constructor. * constructor.
* *
* @return void * @return void
*/ */
Model.prototype.initializeModel= function(){}; Model.prototype.initializeModel= function(){};
...@@ -1711,19 +1711,19 @@ Model.prototype.initializeModel= function(){}; ...@@ -1711,19 +1711,19 @@ Model.prototype.initializeModel= function(){};
/** /**
* Model Multiton Factory method. * Model Multiton Factory method.
* Note that this method will return null if supplied a null * Note that this method will return null if supplied a null
* or undefined multiton key. * or undefined multiton key.
* *
* @param {string} key * @param {string} key
* The multiton key for the Model to retrieve * The multiton key for the Model to retrieve
* @return {puremvc.Model} * @return {puremvc.Model}
* the instance for this Multiton key * the instance for this Multiton key
*/ */
Model.getInstance= function(key) Model.getInstance= function(key)
{ {
if (null == key) if (null == key)
return null; return null;
if(Model.instanceMap[key] == null) if(Model.instanceMap[key] == null)
{ {
Model.instanceMap[key]= new Model(key); Model.instanceMap[key]= new Model(key);
...@@ -1745,7 +1745,7 @@ Model.prototype.registerProxy= function(proxy) ...@@ -1745,7 +1745,7 @@ Model.prototype.registerProxy= function(proxy)
/** /**
* Retrieve a Proxy from the Model * Retrieve a Proxy from the Model
* *
* @param {string} proxyName * @param {string} proxyName
* @return {puremvc.Proxy} * @return {puremvc.Proxy}
* The Proxy instance previously registered with the provided proxyName * The Proxy instance previously registered with the provided proxyName
...@@ -1768,7 +1768,7 @@ Model.prototype.hasProxy= function(proxyName) ...@@ -1768,7 +1768,7 @@ Model.prototype.hasProxy= function(proxyName)
/** /**
* Remove a Proxy from the Model. * Remove a Proxy from the Model.
* *
* @param {string} proxyName * @param {string} proxyName
* The name of the Proxy instance to remove * The name of the Proxy instance to remove
* @return {puremvc.Proxy} * @return {puremvc.Proxy}
...@@ -1789,7 +1789,7 @@ Model.prototype.removeProxy= function(proxyName) ...@@ -1789,7 +1789,7 @@ Model.prototype.removeProxy= function(proxyName)
/** /**
* @static * @static
* Remove a Model instance. * Remove a Model instance.
* *
* @param {string} key * @param {string} key
* @return {void} * @return {void}
*/ */
...@@ -1829,59 +1829,59 @@ Model.prototype.multitonKey; ...@@ -1829,59 +1829,59 @@ Model.prototype.multitonKey;
/** /**
* @ignore * @ignore
* Message Constants * Message Constants
* *
* @static * @static
* @type {string} * @type {string}
*/ */
Model.MULTITON_MSG= "Model instance for this Multiton key already constructed!"; Model.MULTITON_MSG= "Model instance for this Multiton key already constructed!";
/** /**
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @class puremvc.Controller * @class puremvc.Controller
* *
* In PureMVC, the Controller class follows the 'Command and Controller' * In PureMVC, the Controller class follows the 'Command and Controller'
* strategy, and assumes these responsibilities: * strategy, and assumes these responsibilities:
* *
* - Remembering which * - Remembering which
* {@link puremvc.SimpleCommand SimpleCommand}s * {@link puremvc.SimpleCommand SimpleCommand}s
* or * or
* {@link puremvc.MacroCommand MacroCommand}s * {@link puremvc.MacroCommand MacroCommand}s
* are intended to handle which * are intended to handle which
* {@link puremvc.Notification Notification}s * {@link puremvc.Notification Notification}s
* - Registering itself as an * - Registering itself as an
* {@link puremvc.Observer Observer} with * {@link puremvc.Observer Observer} with
* the {@link puremvc.View View} for each * the {@link puremvc.View View} for each
* {@link puremvc.Notification Notification} * {@link puremvc.Notification Notification}
* that it has an * that it has an
* {@link puremvc.SimpleCommand SimpleCommand} * {@link puremvc.SimpleCommand SimpleCommand}
* or {@link puremvc.MacroCommand MacroCommand} * or {@link puremvc.MacroCommand MacroCommand}
* mapping for. * mapping for.
* - Creating a new instance of the proper * - Creating a new instance of the proper
* {@link puremvc.SimpleCommand SimpleCommand}s * {@link puremvc.SimpleCommand SimpleCommand}s
* or * or
* {@link puremvc.MacroCommand MacroCommand}s * {@link puremvc.MacroCommand MacroCommand}s
* to handle a given * to handle a given
* {@link puremvc.Notification Notification} * {@link puremvc.Notification Notification}
* when notified by the * when notified by the
* {@link puremvc.View View}. * {@link puremvc.View View}.
* - Calling the command's execute method, passing in the * - Calling the command's execute method, passing in the
* {@link puremvc.Notification Notification}. * {@link puremvc.Notification Notification}.
* *
* Your application must register * Your application must register
* {@link puremvc.SimpleCommand SimpleCommand}s * {@link puremvc.SimpleCommand SimpleCommand}s
* or {@link puremvc.MacroCommand MacroCommand}s * or {@link puremvc.MacroCommand MacroCommand}s
* with the Controller. * with the Controller.
* *
* The simplest way is to subclass * The simplest way is to subclass
* {@link puremvc.Facade Facade}, * {@link puremvc.Facade Facade},
* and use its * and use its
* {@link puremvc.Facade#initializeController initializeController} * {@link puremvc.Facade#initializeController initializeController}
* method to add your registrations. * method to add your registrations.
* *
* @constructor * @constructor
* This Controller implementation is a Multiton, so you should not call the * This Controller implementation is a Multiton, so you should not call the
* constructor directly, but instead call the static #getInstance factory method, * constructor directly, but instead call the static #getInstance factory method,
* passing the unique key for this instance to it. * passing the unique key for this instance to it.
* @param {string} key * @param {string} key
* @throws {Error} * @throws {Error}
...@@ -1902,7 +1902,7 @@ function Controller(key) ...@@ -1902,7 +1902,7 @@ function Controller(key)
/** /**
* @protected * @protected
* *
* Initialize the multiton Controller instance. * Initialize the multiton Controller instance.
* *
* Called automatically by the constructor. * Called automatically by the constructor.
...@@ -1911,12 +1911,12 @@ function Controller(key) ...@@ -1911,12 +1911,12 @@ function Controller(key)
* in your application, you should *also* subclass Controller * in your application, you should *also* subclass Controller
* and override the initializeController method in the * and override the initializeController method in the
* following way. * following way.
* *
* MyController.prototype.initializeController= function () * MyController.prototype.initializeController= function ()
* { * {
* this.view= MyView.getInstance(this.multitonKey); * this.view= MyView.getInstance(this.multitonKey);
* }; * };
* *
* @return {void} * @return {void}
*/ */
Controller.prototype.initializeController= function() Controller.prototype.initializeController= function()
...@@ -1925,9 +1925,9 @@ Controller.prototype.initializeController= function() ...@@ -1925,9 +1925,9 @@ Controller.prototype.initializeController= function()
}; };
/** /**
* The Controllers multiton factory method. * The Controllers multiton factory method.
* Note that this method will return null if supplied a null * Note that this method will return null if supplied a null
* or undefined multiton key. * or undefined multiton key.
* *
* @param {string} key * @param {string} key
* A Controller's multiton key * A Controller's multiton key
...@@ -1938,7 +1938,7 @@ Controller.getInstance= function(key) ...@@ -1938,7 +1938,7 @@ Controller.getInstance= function(key)
{ {
if (null == key) if (null == key)
return null; return null;
if(null == this.instanceMap[key]) if(null == this.instanceMap[key])
{ {
this.instanceMap[key]= new this(key); this.instanceMap[key]= new this(key);
...@@ -1966,10 +1966,10 @@ Controller.prototype.executeCommand= function(note) ...@@ -1966,10 +1966,10 @@ Controller.prototype.executeCommand= function(note)
}; };
/** /**
* Register a particular SimpleCommand or MacroCommand class as the handler for * Register a particular SimpleCommand or MacroCommand class as the handler for
* a particular Notification. * a particular Notification.
* *
* If an command already been registered to handle Notifications with this name, * If an command already been registered to handle Notifications with this name,
* it is no longer used, the new command is used instead. * it is no longer used, the new command is used instead.
* *
* The Observer for the new command is only created if this the irst time a * The Observer for the new command is only created if this the irst time a
...@@ -2025,7 +2025,7 @@ Controller.prototype.removeCommand= function(notificationName) ...@@ -2025,7 +2025,7 @@ Controller.prototype.removeCommand= function(notificationName)
* @static * @static
* Remove a Controller instance. * Remove a Controller instance.
* *
* @param {string} key * @param {string} key
* multitonKey of Controller instance to remove * multitonKey of Controller instance to remove
* @return {void} * @return {void}
*/ */
...@@ -2036,7 +2036,7 @@ Controller.removeController= function(key) ...@@ -2036,7 +2036,7 @@ Controller.removeController= function(key)
/** /**
* Local reference to the Controller's View * Local reference to the Controller's View
* *
* @protected * @protected
* @type {puremvc.View} * @type {puremvc.View}
*/ */
...@@ -2044,7 +2044,7 @@ Controller.prototype.view= null; ...@@ -2044,7 +2044,7 @@ Controller.prototype.view= null;
/** /**
* Note name to command constructor mappings * Note name to command constructor mappings
* *
* @protected * @protected
* @type {Object} * @type {Object}
*/ */
...@@ -2052,7 +2052,7 @@ Controller.prototype.commandMap= null; ...@@ -2052,7 +2052,7 @@ Controller.prototype.commandMap= null;
/** /**
* The Controller's multiton key * The Controller's multiton key
* *
* @protected * @protected
* @type {string} * @type {string}
*/ */
...@@ -2060,7 +2060,7 @@ Controller.prototype.multitonKey= null; ...@@ -2060,7 +2060,7 @@ Controller.prototype.multitonKey= null;
/** /**
* Multiton key to Controller instance mappings * Multiton key to Controller instance mappings
* *
* @static * @static
* @protected * @protected
* @type {Object} * @type {Object}
...@@ -2069,7 +2069,7 @@ Controller.instanceMap= []; ...@@ -2069,7 +2069,7 @@ Controller.instanceMap= [];
/** /**
* @ignore * @ignore
* *
* Message constants * Message constants
* @static * @static
* @protected * @protected
...@@ -2077,9 +2077,9 @@ Controller.instanceMap= []; ...@@ -2077,9 +2077,9 @@ Controller.instanceMap= [];
*/ */
Controller.MULTITON_MSG= "controller key for this Multiton key already constructed" Controller.MULTITON_MSG= "controller key for this Multiton key already constructed"
/* /*
* @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau * @author PureMVC JS Native Port by David Foley, Frédéric Saunier, & Alain Duchesneau
* @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved. * @author Copyright(c) 2006-2012 Futurescale, Inc., Some rights reserved.
* *
* @hide * @hide
* A an internal helper class used to assist classlet implementation. This * A an internal helper class used to assist classlet implementation. This
* class is not accessible by client code. * class is not accessible by client code.
...@@ -2089,67 +2089,67 @@ var OopHelp= ...@@ -2089,67 +2089,67 @@ var OopHelp=
/* /*
* @private * @private
* A reference to the global scope. We use this rather than window * A reference to the global scope. We use this rather than window
* in order to support both browser based and non browser baed * in order to support both browser based and non browser baed
* JavaScript interpreters. * JavaScript interpreters.
* @type {Object} * @type {Object}
*/ */
global: (function(){return this})() global: (function(){return this})()
/* /*
* @private * @private
* Extend one Function's prototype by another, emulating classic * Extend one Function's prototype by another, emulating classic
* inheritance. * inheritance.
* *
* @param {Function} child * @param {Function} child
* The Function to extend (subclass) * The Function to extend (subclass)
* *
* @param {Function} parent * @param {Function} parent
* The Function to extend from (superclass) * The Function to extend from (superclass)
* *
* @return {Function} * @return {Function}
* *
* A reference to the extended Function (subclass) * A reference to the extended Function (subclass)
*/ */
, extend: function (child, parent) , extend: function (child, parent)
{ {
if ('function' !== typeof child) if ('function' !== typeof child)
throw new TypeError('#extend- child should be Function'); throw new TypeError('#extend- child should be Function');
if ('function' !== typeof parent) if ('function' !== typeof parent)
throw new TypeError('#extend- parent should be Function'); throw new TypeError('#extend- parent should be Function');
if (parent === child) if (parent === child)
return; return;
var Transitive= new Function; var Transitive= new Function;
Transitive.prototype= parent.prototype; Transitive.prototype= parent.prototype;
child.prototype= new Transitive; child.prototype= new Transitive;
return child.prototype.constructor= child; return child.prototype.constructor= child;
} }
/* /*
* @private * @private
* Decoarate one object with the properties of another. * Decoarate one object with the properties of another.
* *
* @param {Object} object * @param {Object} object
* The object to decorate. * The object to decorate.
* *
* @param {Object} traits * @param {Object} traits
* The object providing the properites that the first object * The object providing the properites that the first object
* will be decorated with. Note that only properties defined on * will be decorated with. Note that only properties defined on
* this object will be copied- i.e. inherited properties will * this object will be copied- i.e. inherited properties will
* be ignored. * be ignored.
* *
* @return {Object} * @return {Object}
* THe decorated object (first argument) * THe decorated object (first argument)
*/ */
, decorate: function (object, traits) , decorate: function (object, traits)
{ {
for (var accessor in traits) for (var accessor in traits)
{ {
object[accessor]= traits[accessor]; object[accessor]= traits[accessor];
} }
return object; return object;
} }
}; };
...@@ -2157,51 +2157,51 @@ var OopHelp= ...@@ -2157,51 +2157,51 @@ var OopHelp=
/** /**
* @member puremvc * @member puremvc
* *
* Declare a namespace and optionally make an Object the referent * Declare a namespace and optionally make an Object the referent
* of that namespace. * of that namespace.
* *
* console.assert(null == window.tld, 'No tld namespace'); * console.assert(null == window.tld, 'No tld namespace');
* // declare the tld namespace * // declare the tld namespace
* puremvc.declare('tld'); * puremvc.declare('tld');
* console.assert('object' === typeof tld, 'The tld namespace was declared'); * console.assert('object' === typeof tld, 'The tld namespace was declared');
* *
* // the method returns a reference to last namespace node in a created hierarchy * // the method returns a reference to last namespace node in a created hierarchy
* var reference= puremvc.declare('tld.domain.app'); * var reference= puremvc.declare('tld.domain.app');
* console.assert(reference === tld.domain.app) * console.assert(reference === tld.domain.app)
* *
* // of course you can also declare your own objects as well * // of course you can also declare your own objects as well
* var AppConstants= * var AppConstants=
* { * {
* APP_NAME: 'tld.domain.app.App' * APP_NAME: 'tld.domain.app.App'
* }; * };
* *
* puremvc.declare('tld.domain.app.AppConstants', AppConstants); * puremvc.declare('tld.domain.app.AppConstants', AppConstants);
* console.assert(AppConstants === tld.domain.app.AppConstants * console.assert(AppConstants === tld.domain.app.AppConstants
* , 'AppConstants was exported to the namespace'); * , 'AppConstants was exported to the namespace');
* *
* Note that you can also #declare within a closure. That way you * Note that you can also #declare within a closure. That way you
* can selectively export Objects to your own namespaces without * can selectively export Objects to your own namespaces without
* leaking variables into the global scope. * leaking variables into the global scope.
* *
* (function(){ * (function(){
* // this var is not accessible outside of this * // this var is not accessible outside of this
* // closures call scope * // closures call scope
* var hiddenValue= 'defaultValue'; * var hiddenValue= 'defaultValue';
* *
* // export an object that references the hidden * // export an object that references the hidden
* // variable and which can mutate it * // variable and which can mutate it
* puremvc.declare * puremvc.declare
* ( * (
* 'tld.domain.app.backdoor' * 'tld.domain.app.backdoor'
* *
* , { * , {
* setValue: function (value) * setValue: function (value)
* { * {
* // assigns to the hidden var * // assigns to the hidden var
* hiddenValue= value; * hiddenValue= value;
* } * }
* *
* , getValue: function () * , getValue: function ()
* { * {
* // reads from the hidden var * // reads from the hidden var
...@@ -2216,31 +2216,31 @@ var OopHelp= ...@@ -2216,31 +2216,31 @@ var OopHelp=
* tld.domain.app.backdoor.setValue('newValue'); * tld.domain.app.backdoor.setValue('newValue');
* // the hidden var was mutated * // the hidden var was mutated
* console.assert('newValue' === tld.domain.app.backdoor.getValue()); * console.assert('newValue' === tld.domain.app.backdoor.getValue());
* *
* On occasion, primarily during testing, you may want to use declare, * On occasion, primarily during testing, you may want to use declare,
* but not have the global object be the namespace root. In these cases you * but not have the global object be the namespace root. In these cases you
* can supply the optional third scope argument. * can supply the optional third scope argument.
* *
* var localScope= {} * var localScope= {}
* , object= {} * , object= {}
* *
* puremvc.declare('mock.object', object, localScope); * puremvc.declare('mock.object', object, localScope);
* *
* console.assert(null == window.mock, 'mock namespace is not in global scope'); * console.assert(null == window.mock, 'mock namespace is not in global scope');
* console.assert(object === localScope.mock.object, 'mock.object is available in localScope'); * console.assert(object === localScope.mock.object, 'mock.object is available in localScope');
* *
* @param {string} string * @param {string} string
* A qualified object name, e.g. 'com.example.Class' * A qualified object name, e.g. 'com.example.Class'
* *
* @param {Object} [object] * @param {Object} [object]
* An object to make the referent of the namespace. * An object to make the referent of the namespace.
* *
* @param {Object} [scope] * @param {Object} [scope]
* The namespace's root node. If not supplied, the global * The namespace's root node. If not supplied, the global
* scope will be namespaces root node. * scope will be namespaces root node.
* *
* @return {Object} * @return {Object}
* *
* A reference to the last node of the Object hierarchy created. * A reference to the last node of the Object hierarchy created.
*/ */
function declare (qualifiedName, object, scope) function declare (qualifiedName, object, scope)
...@@ -2250,18 +2250,18 @@ function declare (qualifiedName, object, scope) ...@@ -2250,18 +2250,18 @@ function declare (qualifiedName, object, scope)
, lastNode , lastNode
, newNode , newNode
, nodeName; , nodeName;
for (var i= 0, n= nodes.length; i < n; i++) for (var i= 0, n= nodes.length; i < n; i++)
{ {
lastNode= node; lastNode= node;
nodeName= nodes[i]; nodeName= nodes[i];
node= (null == node[nodeName] ? node[nodeName] = {} : node[nodeName]); node= (null == node[nodeName] ? node[nodeName] = {} : node[nodeName]);
} }
if (null == object) if (null == object)
return node; return node;
return lastNode[nodeName]= object; return lastNode[nodeName]= object;
}; };
...@@ -2270,15 +2270,15 @@ function declare (qualifiedName, object, scope) ...@@ -2270,15 +2270,15 @@ function declare (qualifiedName, object, scope)
/** /**
* @member puremvc * @member puremvc
* *
* Define a new classlet. Current editions of JavaScript do not have classes, * Define a new classlet. Current editions of JavaScript do not have classes,
* but they can be emulated, and this method does this for you, saving you * but they can be emulated, and this method does this for you, saving you
* from having to work with Function prototype directly. The method does * from having to work with Function prototype directly. The method does
* not extend any Native objects and is entirely opt in. Its particularly * not extend any Native objects and is entirely opt in. Its particularly
* usefull if you want to make your PureMvc applications more portable, by * usefull if you want to make your PureMvc applications more portable, by
* decoupling them from a specific OOP abstraction library. * decoupling them from a specific OOP abstraction library.
* *
* *
* puremvc.define * puremvc.define
* ( * (
* // the first object supplied is a class descriptor. None of these * // the first object supplied is a class descriptor. None of these
...@@ -2286,32 +2286,32 @@ function declare (qualifiedName, object, scope) ...@@ -2286,32 +2286,32 @@ function declare (qualifiedName, object, scope)
* // constructor property, which if supplied, will be your classes * // constructor property, which if supplied, will be your classes
* // constructor. * // constructor.
* { * {
* // your classes namespace- if supplied, it will be * // your classes namespace- if supplied, it will be
* // created for you * // created for you
* name: 'com.example.UserMediator' * name: 'com.example.UserMediator'
* *
* // your classes parent class. If supplied, inheritance * // your classes parent class. If supplied, inheritance
* // will be taken care of for you * // will be taken care of for you
* , parent: puremvc.Mediator * , parent: puremvc.Mediator
* *
* // your classes constructor. If not supplied, one will be * // your classes constructor. If not supplied, one will be
* // created for you * // created for you
* , constructor: function UserMediator (component) * , constructor: function UserMediator (component)
* { * {
* puremvc.Mediator.call(this, this.constructor.NAME, component); * puremvc.Mediator.call(this, this.constructor.NAME, component);
* } * }
* } * }
* *
* // the second object supplied defines your class traits, that is * // the second object supplied defines your class traits, that is
* // the properties that will be defined on your classes prototype * // the properties that will be defined on your classes prototype
* // and thereby on all instances of this class * // and thereby on all instances of this class
* , { * , {
* businessMethod: function () * businessMethod: function ()
* { * {
* // impl * // impl
* } * }
* } * }
* *
* // the third object supplied defines your classes 'static' traits * // the third object supplied defines your classes 'static' traits
* // that is, the methods and properties which will be defined on * // that is, the methods and properties which will be defined on
* // your classes constructor * // your classes constructor
...@@ -2319,27 +2319,27 @@ function declare (qualifiedName, object, scope) ...@@ -2319,27 +2319,27 @@ function declare (qualifiedName, object, scope)
* NAME: 'userMediator' * NAME: 'userMediator'
* } * }
* ); * );
* *
* @param {Object} [classinfo] * @param {Object} [classinfo]
* An object describing the class. This object can have any or all of * An object describing the class. This object can have any or all of
* the following properties: * the following properties:
* *
* - name: String * - name: String
* The classlets name. This can be any arbitrary qualified object * The classlets name. This can be any arbitrary qualified object
* name. 'com.example.Classlet' or simply 'MyClasslet' for example * name. 'com.example.Classlet' or simply 'MyClasslet' for example
* The method will automatically create an object hierarchy refering * The method will automatically create an object hierarchy refering
* to your class for you. Note that you will need to capture the * to your class for you. Note that you will need to capture the
* methods return value to retrieve a reference to your class if the * methods return value to retrieve a reference to your class if the
* class name property is not defined. * class name property is not defined.
* - parent: Function * - parent: Function
* The classlets 'superclass'. Your class will be extended from this * The classlets 'superclass'. Your class will be extended from this
* if supplied. * if supplied.
* *
* - constructor: Function * - constructor: Function
* The classlets constructor. Note this is *not* a post construct * The classlets constructor. Note this is *not* a post construct
* initialize method, but your classes constructor Function. * initialize method, but your classes constructor Function.
* If this attribute is not defined, a constructor will be created for * If this attribute is not defined, a constructor will be created for
* you automatically. If you have supplied a parent class * you automatically. If you have supplied a parent class
* value and not defined the classes constructor, the automatically * value and not defined the classes constructor, the automatically
* created constructor will invoke the super class constructor * created constructor will invoke the super class constructor
...@@ -2347,22 +2347,22 @@ function declare (qualifiedName, object, scope) ...@@ -2347,22 +2347,22 @@ function declare (qualifiedName, object, scope)
* wish to invoke it's super constructor, you must do this manually, as * wish to invoke it's super constructor, you must do this manually, as
* there is no reference to the classes parent added to the constructor * there is no reference to the classes parent added to the constructor
* prototype. * prototype.
* *
* - scope: Object. * - scope: Object.
* For use in advanced scenarios. If the name attribute has been supplied, * For use in advanced scenarios. If the name attribute has been supplied,
* this value will be the root of the object hierarchy created for you. * this value will be the root of the object hierarchy created for you.
* Use it do define your own class hierarchies in private scopes, * Use it do define your own class hierarchies in private scopes,
* accross iFrames, in your unit tests, or avoid collision with third * accross iFrames, in your unit tests, or avoid collision with third
* party library namespaces. * party library namespaces.
* *
* @param {Object} [traits] * @param {Object} [traits]
* An Object, the properties of which will be added to the * An Object, the properties of which will be added to the
* class constructors prototype. * class constructors prototype.
* *
* @param {Object} [staitcTraits] * @param {Object} [staitcTraits]
* An Object, the properties of which will be added directly * An Object, the properties of which will be added directly
* to this class constructor * to this class constructor
* *
* @return {Function} * @return {Function}
* A reference to the classlets constructor * A reference to the classlets constructor
*/ */
...@@ -2384,14 +2384,14 @@ function define (classInfo, traits, staticTraits) ...@@ -2384,14 +2384,14 @@ function define (classInfo, traits, staticTraits)
{ {
throw new TypeError('Class parent must be Function'); throw new TypeError('Class parent must be Function');
} }
if (classInfo.hasOwnProperty('constructor')) if (classInfo.hasOwnProperty('constructor'))
{ {
classConstructor= classInfo.constructor classConstructor= classInfo.constructor
if ('function' !== typeof classConstructor) if ('function' !== typeof classConstructor)
{ {
throw new TypeError('Class constructor must be Function') throw new TypeError('Class constructor must be Function')
} }
} }
else // there is no constructor, create one else // there is no constructor, create one
{ {
...@@ -2405,60 +2405,60 @@ function define (classInfo, traits, staticTraits) ...@@ -2405,60 +2405,60 @@ function define (classInfo, traits, staticTraits)
else // just create a Function else // just create a Function
{ {
classConstructor= new Function; classConstructor= new Function;
} }
} }
if (doExtend) if (doExtend)
{ {
OopHelp.extend(classConstructor, classParent); OopHelp.extend(classConstructor, classParent);
} }
if (traits) if (traits)
{ {
prototype= classConstructor.prototype prototype= classConstructor.prototype
OopHelp.decorate(prototype, traits); OopHelp.decorate(prototype, traits);
// reassign constructor // reassign constructor
prototype.constructor= classConstructor; prototype.constructor= classConstructor;
} }
if (staticTraits) if (staticTraits)
{ {
OopHelp.decorate(classConstructor, staticTraits) OopHelp.decorate(classConstructor, staticTraits)
} }
if (className) if (className)
{ {
if ('string' !== typeof className) if ('string' !== typeof className)
{ {
throw new TypeError('Class name must be primitive string'); throw new TypeError('Class name must be primitive string');
} }
declare (className, classConstructor, classScope); declare (className, classConstructor, classScope);
} }
return classConstructor; return classConstructor;
}; };
/* implementation end */ /* implementation end */
// define the puremvc global namespace and export the actors // define the puremvc global namespace and export the actors
scope.puremvc= scope.puremvc=
{ {
View: View View: View
, Model: Model , Model: Model
, Controller: Controller , Controller: Controller
, SimpleCommand: SimpleCommand , SimpleCommand: SimpleCommand
, MacroCommand: MacroCommand , MacroCommand: MacroCommand
, Facade: Facade , Facade: Facade
, Mediator: Mediator , Mediator: Mediator
, Observer: Observer , Observer: Observer
, Notification: Notification , Notification: Notification
, Notifier: Notifier , Notifier: Notifier
, Proxy: Proxy , Proxy: Proxy
, define: define , define: define
, declare: declare , declare: declare
}; };
})(this); // the 'this' parameter will resolve to global scope in all environments })(this); // the 'this' parameter will resolve to global scope in all environments
\ No newline at end of file
...@@ -12,104 +12,77 @@ button { ...@@ -12,104 +12,77 @@ button {
font-size: 100%; font-size: 100%;
vertical-align: baseline; vertical-align: baseline;
font-family: inherit; font-family: inherit;
font-weight: inherit;
color: inherit; color: inherit;
-webkit-appearance: none; -webkit-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none; appearance: none;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
} }
body { body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em; line-height: 1.4em;
background: #eaeaea url('bg.png'); background: #f5f5f5;
color: #4d4d4d; color: #4d4d4d;
width: 550px; min-width: 230px;
max-width: 550px;
margin: 0 auto; margin: 0 auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased; -moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased; font-smoothing: antialiased;
font-weight: 300;
} }
button, button,
input[type="checkbox"] { input[type="checkbox"] {
outline: none; outline: none;
}
.hidden {
display: none;
} }
#todoapp { #todoapp {
background: #fff; background: #fff;
background: rgba(255, 255, 255, 0.9);
margin: 130px 0 40px 0; margin: 130px 0 40px 0;
border: 1px solid #ccc;
position: relative; position: relative;
border-top-left-radius: 2px; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2),
border-top-right-radius: 2px; 0 25px 50px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}
#todoapp:before {
content: '';
border-left: 1px solid #f5d6d6;
border-right: 1px solid #f5d6d6;
width: 2px;
position: absolute;
top: 0;
left: 40px;
height: 100%;
} }
#todoapp input::-webkit-input-placeholder { #todoapp input::-webkit-input-placeholder {
font-style: italic; font-style: italic;
font-weight: 300;
color: #e6e6e6;
} }
#todoapp input::-moz-placeholder { #todoapp input::-moz-placeholder {
font-style: italic; font-style: italic;
color: #a9a9a9; font-weight: 300;
color: #e6e6e6;
}
#todoapp input::input-placeholder {
font-style: italic;
font-weight: 300;
color: #e6e6e6;
} }
#todoapp h1 { #todoapp h1 {
position: absolute; position: absolute;
top: -120px; top: -155px;
width: 100%; width: 100%;
font-size: 70px; font-size: 100px;
font-weight: bold; font-weight: 100;
text-align: center; text-align: center;
color: #b3b3b3; color: rgba(175, 47, 47, 0.15);
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
-webkit-text-rendering: optimizeLegibility; -webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility; -moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
} }
#header {
padding-top: 15px;
border-radius: inherit;
}
#header:before {
content: '';
position: absolute;
top: 0;
right: 0;
left: 0;
height: 15px;
z-index: 2;
border-bottom: 1px solid #6c615c;
background: #8d7d77;
background: -webkit-gradient(linear, left top, left bottom, from(rgba(132, 110, 100, 0.8)),to(rgba(101, 84, 76, 0.8)));
background: -webkit-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');
border-top-left-radius: 1px;
border-top-right-radius: 1px;
}
#new-todo, #new-todo,
.edit { .edit {
position: relative; position: relative;
...@@ -117,6 +90,7 @@ input[type="checkbox"] { ...@@ -117,6 +90,7 @@ input[type="checkbox"] {
width: 100%; width: 100%;
font-size: 24px; font-size: 24px;
font-family: inherit; font-family: inherit;
font-weight: inherit;
line-height: 1.4em; line-height: 1.4em;
border: 0; border: 0;
outline: none; outline: none;
...@@ -124,29 +98,23 @@ input[type="checkbox"] { ...@@ -124,29 +98,23 @@ input[type="checkbox"] {
padding: 6px; padding: 6px;
border: 1px solid #999; border: 1px solid #999;
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased; -moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased; font-smoothing: antialiased;
} }
#new-todo { #new-todo {
padding: 16px 16px 16px 60px; padding: 16px 16px 16px 60px;
border: none; border: none;
background: rgba(0, 0, 0, 0.02); background: rgba(0, 0, 0, 0.003);
z-index: 2; box-shadow: inset 0 -2px 1px rgba(0,0,0,0.03);
box-shadow: none;
} }
#main { #main {
position: relative; position: relative;
z-index: 2; z-index: 2;
border-top: 1px dotted #adadad; border-top: 1px solid #e6e6e6;
} }
label[for='toggle-all'] { label[for='toggle-all'] {
...@@ -155,19 +123,19 @@ label[for='toggle-all'] { ...@@ -155,19 +123,19 @@ label[for='toggle-all'] {
#toggle-all { #toggle-all {
position: absolute; position: absolute;
top: -42px; top: -55px;
left: -4px; left: -12px;
width: 40px; width: 60px;
height: 34px;
text-align: center; text-align: center;
/* Mobile Safari */ border: none; /* Mobile Safari */
border: none;
} }
#toggle-all:before { #toggle-all:before {
content: '»'; content: '';
font-size: 28px; font-size: 22px;
color: #d9d9d9; color: #e6e6e6;
padding: 0 25px 7px; padding: 10px 27px 10px 27px;
} }
#toggle-all:checked:before { #toggle-all:checked:before {
...@@ -183,7 +151,7 @@ label[for='toggle-all'] { ...@@ -183,7 +151,7 @@ label[for='toggle-all'] {
#todo-list li { #todo-list li {
position: relative; position: relative;
font-size: 24px; font-size: 24px;
border-bottom: 1px dotted #ccc; border-bottom: 1px solid #ededed;
} }
#todo-list li:last-child { #todo-list li:last-child {
...@@ -215,28 +183,17 @@ label[for='toggle-all'] { ...@@ -215,28 +183,17 @@ label[for='toggle-all'] {
top: 0; top: 0;
bottom: 0; bottom: 0;
margin: auto 0; margin: auto 0;
/* Mobile Safari */ border: none; /* Mobile Safari */
border: none;
-webkit-appearance: none; -webkit-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none; appearance: none;
} }
#todo-list li .toggle:after { #todo-list li .toggle:after {
content: '✔'; content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#ededed" stroke-width="3"/></svg>');
/* 40 + a couple of pixels visual adjustment */
line-height: 43px;
font-size: 20px;
color: #d9d9d9;
text-shadow: 0 -1px 0 #bfbfbf;
} }
#todo-list li .toggle:checked:after { #todo-list li .toggle:checked:after {
color: #85ada7; content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#bddad5" stroke-width="3"/><path fill="#5dc2af" d="M72 25L42 71 27 56l-4 4 20 20 34-52z"/></svg>');
text-shadow: 0 1px 0 #669991;
bottom: 1px;
position: relative;
} }
#todo-list li label { #todo-list li label {
...@@ -246,12 +203,11 @@ label[for='toggle-all'] { ...@@ -246,12 +203,11 @@ label[for='toggle-all'] {
margin-left: 45px; margin-left: 45px;
display: block; display: block;
line-height: 1.2; line-height: 1.2;
-webkit-transition: color 0.4s;
transition: color 0.4s; transition: color 0.4s;
} }
#todo-list li.completed label { #todo-list li.completed label {
color: #a9a9a9; color: #d9d9d9;
text-decoration: line-through; text-decoration: line-through;
} }
...@@ -264,21 +220,18 @@ label[for='toggle-all'] { ...@@ -264,21 +220,18 @@ label[for='toggle-all'] {
width: 40px; width: 40px;
height: 40px; height: 40px;
margin: auto 0; margin: auto 0;
font-size: 22px; font-size: 30px;
color: #a88a8a; color: #cc9a9a;
-webkit-transition: all 0.2s; margin-bottom: 11px;
transition: all 0.2s; transition: color 0.2s ease-out;
} }
#todo-list li .destroy:hover { #todo-list li .destroy:hover {
text-shadow: 0 0 1px #000, color: #af5b5e;
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
transform: scale(1.3);
} }
#todo-list li .destroy:after { #todo-list li .destroy:after {
content: ''; content: '×';
} }
#todo-list li:hover .destroy { #todo-list li:hover .destroy {
...@@ -295,29 +248,25 @@ label[for='toggle-all'] { ...@@ -295,29 +248,25 @@ label[for='toggle-all'] {
#footer { #footer {
color: #777; color: #777;
padding: 0 15px; padding: 10px 15px;
position: absolute;
right: 0;
bottom: -31px;
left: 0;
height: 20px; height: 20px;
z-index: 1;
text-align: center; text-align: center;
border-top: 1px solid #e6e6e6;
} }
#footer:before { #footer:before {
content: ''; content: '';
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 31px; bottom: 0;
left: 0; left: 0;
height: 50px; height: 50px;
z-index: -1; overflow: hidden;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2),
0 6px 0 -3px rgba(255, 255, 255, 0.8), 0 8px 0 -3px #f6f6f6,
0 7px 1px -3px rgba(0, 0, 0, 0.3), 0 9px 1px -3px rgba(0, 0, 0, 0.2),
0 43px 0 -6px rgba(255, 255, 255, 0.8), 0 16px 0 -6px #f6f6f6,
0 44px 2px -6px rgba(0, 0, 0, 0.2); 0 17px 2px -6px rgba(0, 0, 0, 0.2);
} }
#todo-count { #todo-count {
...@@ -325,6 +274,10 @@ label[for='toggle-all'] { ...@@ -325,6 +274,10 @@ label[for='toggle-all'] {
text-align: left; text-align: left;
} }
#todo-count strong {
font-weight: 300;
}
#filters { #filters {
margin: 0; margin: 0;
padding: 0; padding: 0;
...@@ -339,49 +292,63 @@ label[for='toggle-all'] { ...@@ -339,49 +292,63 @@ label[for='toggle-all'] {
} }
#filters li a { #filters li a {
color: #83756f; color: inherit;
margin: 2px; margin: 3px;
padding: 3px 7px;
text-decoration: none; text-decoration: none;
border: 1px solid transparent;
border-radius: 3px;
}
#filters li a.selected,
#filters li a:hover {
border-color: rgba(175, 47, 47, 0.1);
} }
#filters li a.selected { #filters li a.selected {
font-weight: bold; border-color: rgba(175, 47, 47, 0.2);
} }
#clear-completed { #clear-completed,
html #clear-completed:active {
float: right; float: right;
position: relative; position: relative;
line-height: 20px; line-height: 20px;
text-decoration: none; text-decoration: none;
background: rgba(0, 0, 0, 0.1); cursor: pointer;
font-size: 11px; position: relative;
padding: 0 10px;
border-radius: 3px;
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.2);
} }
#clear-completed:hover { #clear-completed:hover {
background: rgba(0, 0, 0, 0.15); text-decoration: underline;
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.3);
} }
#info { #info {
margin: 65px auto 0; margin: 65px auto 0;
color: #a6a6a6; color: #bfbfbf;
font-size: 12px; font-size: 10px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-align: center; text-align: center;
} }
#info p {
line-height: 1;
}
#info a { #info a {
color: inherit; color: inherit;
text-decoration: none;
font-weight: 400;
}
#info a:hover {
text-decoration: underline;
} }
/* /*
Hack to remove background from Mobile Safari. Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox and Opera Can't use it globally since it destroys checkboxes in Firefox
*/ */
@media screen and (-webkit-min-device-pixel-ratio:0) { @media screen and (-webkit-min-device-pixel-ratio:0) {
#toggle-all, #toggle-all,
#todo-list li .toggle { #todo-list li .toggle {
...@@ -393,10 +360,6 @@ label[for='toggle-all'] { ...@@ -393,10 +360,6 @@ label[for='toggle-all'] {
} }
#toggle-all { #toggle-all {
top: -56px;
left: -15px;
width: 65px;
height: 41px;
-webkit-transform: rotate(90deg); -webkit-transform: rotate(90deg);
transform: rotate(90deg); transform: rotate(90deg);
-webkit-appearance: none; -webkit-appearance: none;
...@@ -404,151 +367,12 @@ label[for='toggle-all'] { ...@@ -404,151 +367,12 @@ label[for='toggle-all'] {
} }
} }
.hidden { @media (max-width: 430px) {
display: none; #footer {
} height: 50px;
hr {
margin: 20px 0;
border: 0;
border-top: 1px dashed #C5C5C5;
border-bottom: 1px dashed #F7F7F7;
}
.learn a {
font-weight: normal;
text-decoration: none;
color: #b83f45;
}
.learn a:hover {
text-decoration: underline;
color: #787e7e;
}
.learn h3,
.learn h4,
.learn h5 {
margin: 10px 0;
font-weight: 500;
line-height: 1.2;
color: #000;
}
.learn h3 {
font-size: 24px;
}
.learn h4 {
font-size: 18px;
}
.learn h5 {
margin-bottom: 0;
font-size: 14px;
}
.learn ul {
padding: 0;
margin: 0 0 30px 25px;
}
.learn li {
line-height: 20px;
}
.learn p {
font-size: 15px;
font-weight: 300;
line-height: 1.3;
margin-top: 0;
margin-bottom: 0;
}
.quote {
border: none;
margin: 20px 0 60px 0;
}
.quote p {
font-style: italic;
}
.quote p:before {
content: '“';
font-size: 50px;
opacity: .15;
position: absolute;
top: -20px;
left: 3px;
}
.quote p:after {
content: '”';
font-size: 50px;
opacity: .15;
position: absolute;
bottom: -42px;
right: 3px;
}
.quote footer {
position: absolute;
bottom: -40px;
right: 0;
}
.quote footer img {
border-radius: 3px;
}
.quote footer a {
margin-left: 5px;
vertical-align: middle;
}
.speech-bubble {
position: relative;
padding: 10px;
background: rgba(0, 0, 0, .04);
border-radius: 5px;
}
.speech-bubble:after {
content: '';
position: absolute;
top: 100%;
right: 30px;
border: 13px solid transparent;
border-top-color: rgba(0, 0, 0, .04);
}
.learn-bar > .learn {
position: absolute;
width: 272px;
top: 8px;
left: -300px;
padding: 10px;
border-radius: 5px;
background-color: rgba(255, 255, 255, .6);
-webkit-transition-property: left;
transition-property: left;
-webkit-transition-duration: 500ms;
transition-duration: 500ms;
}
@media (min-width: 899px) {
.learn-bar {
width: auto;
margin: 0 0 0 300px;
}
.learn-bar > .learn {
left: 8px;
} }
.learn-bar #todoapp { #filters {
width: 550px; bottom: 10px;
margin: 130px auto 40px auto;
} }
} }
hr {
margin: 20px 0;
border: 0;
border-top: 1px dashed #c5c5c5;
border-bottom: 1px dashed #f7f7f7;
}
.learn a {
font-weight: normal;
text-decoration: none;
color: #b83f45;
}
.learn a:hover {
text-decoration: underline;
color: #787e7e;
}
.learn h3,
.learn h4,
.learn h5 {
margin: 10px 0;
font-weight: 500;
line-height: 1.2;
color: #000;
}
.learn h3 {
font-size: 24px;
}
.learn h4 {
font-size: 18px;
}
.learn h5 {
margin-bottom: 0;
font-size: 14px;
}
.learn ul {
padding: 0;
margin: 0 0 30px 25px;
}
.learn li {
line-height: 20px;
}
.learn p {
font-size: 15px;
font-weight: 300;
line-height: 1.3;
margin-top: 0;
margin-bottom: 0;
}
#issue-count {
display: none;
}
.quote {
border: none;
margin: 20px 0 60px 0;
}
.quote p {
font-style: italic;
}
.quote p:before {
content: '“';
font-size: 50px;
opacity: .15;
position: absolute;
top: -20px;
left: 3px;
}
.quote p:after {
content: '”';
font-size: 50px;
opacity: .15;
position: absolute;
bottom: -42px;
right: 3px;
}
.quote footer {
position: absolute;
bottom: -40px;
right: 0;
}
.quote footer img {
border-radius: 3px;
}
.quote footer a {
margin-left: 5px;
vertical-align: middle;
}
.speech-bubble {
position: relative;
padding: 10px;
background: rgba(0, 0, 0, .04);
border-radius: 5px;
}
.speech-bubble:after {
content: '';
position: absolute;
top: 100%;
right: 30px;
border: 13px solid transparent;
border-top-color: rgba(0, 0, 0, .04);
}
.learn-bar > .learn {
position: absolute;
width: 272px;
top: 8px;
left: -300px;
padding: 10px;
border-radius: 5px;
background-color: rgba(255, 255, 255, .6);
transition-property: left;
transition-duration: 500ms;
}
@media (min-width: 899px) {
.learn-bar {
width: auto;
padding-left: 300px;
}
.learn-bar > .learn {
left: 8px;
}
}
/* global _ */
(function () { (function () {
'use strict'; 'use strict';
/* jshint ignore:start */
// Underscore's Template Module // Underscore's Template Module
// Courtesy of underscorejs.org // Courtesy of underscorejs.org
var _ = (function (_) { var _ = (function (_) {
...@@ -112,8 +114,14 @@ ...@@ -112,8 +114,14 @@
})({}); })({});
if (location.hostname === 'todomvc.com') { if (location.hostname === 'todomvc.com') {
window._gaq = [['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script')); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-31081062-1', 'auto');
ga('send', 'pageview');
} }
/* jshint ignore:end */
function redirect() { function redirect() {
if (location.hostname === 'tastejs.github.io') { if (location.hostname === 'tastejs.github.io') {
...@@ -175,13 +183,17 @@ ...@@ -175,13 +183,17 @@
if (learnJSON.backend) { if (learnJSON.backend) {
this.frameworkJSON = learnJSON.backend; this.frameworkJSON = learnJSON.backend;
this.frameworkJSON.issueLabel = framework;
this.append({ this.append({
backend: true backend: true
}); });
} else if (learnJSON[framework]) { } else if (learnJSON[framework]) {
this.frameworkJSON = learnJSON[framework]; this.frameworkJSON = learnJSON[framework];
this.frameworkJSON.issueLabel = framework;
this.append(); this.append();
} }
this.fetchIssueCount();
} }
Learn.prototype.append = function (opts) { Learn.prototype.append = function (opts) {
...@@ -212,6 +224,26 @@ ...@@ -212,6 +224,26 @@
document.body.insertAdjacentHTML('afterBegin', aside.outerHTML); document.body.insertAdjacentHTML('afterBegin', aside.outerHTML);
}; };
Learn.prototype.fetchIssueCount = function () {
var issueLink = document.getElementById('issue-count-link');
if (issueLink) {
var url = issueLink.href.replace('https://github.com', 'https://api.github.com/repos');
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function (e) {
var parsedResponse = JSON.parse(e.target.responseText);
if (parsedResponse instanceof Array) {
var count = parsedResponse.length;
if (count !== 0) {
issueLink.innerHTML = 'This app has ' + count + ' open issues';
document.getElementById('issue-count').style.display = 'inline';
}
}
};
xhr.send();
}
};
redirect(); redirect();
getFile('learn.json', Learn); getFile('learn.json', Learn);
})(); })();
{
"private": true,
"dependencies": {
"npmvc": "^1.0.1",
"director": "^1.2.0",
"todomvc-common": "^1.0.0",
"todomvc-app-css": "^1.0.0"
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment