diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 0e9af16..7783b8f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -37,14 +37,14 @@
-
+
-
+
@@ -53,10 +53,10 @@
-
-
+
+
-
+
@@ -66,8 +66,18 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -76,13 +86,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -93,18 +113,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -113,16 +123,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -152,12 +152,14 @@
-
-
-
+
+
+
+
+
@@ -167,6 +169,25 @@
+
+
+
+
+
+
+
+
+ Spelling
+
+
+
+
+ SpellCheckingInspection
+
+
+
+
+
@@ -193,6 +214,7 @@
+
@@ -259,7 +281,6 @@
-
@@ -279,6 +300,14 @@
+
+
+
+
+
+
+
+
@@ -289,12 +318,14 @@
-
-
-
+
+
+
-
-
+
+
+
+
@@ -304,16 +335,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -350,11 +371,11 @@
-
+
-
+
@@ -379,14 +400,6 @@
-
-
-
-
-
-
-
-
@@ -403,7 +416,7 @@
-
+
@@ -411,7 +424,7 @@
-
+
@@ -427,7 +440,7 @@
-
+
@@ -435,7 +448,7 @@
-
+
@@ -451,7 +464,7 @@
-
+
@@ -459,7 +472,7 @@
-
+
@@ -475,7 +488,7 @@
-
+
@@ -483,7 +496,7 @@
-
+
@@ -499,7 +512,7 @@
-
+
@@ -523,7 +536,7 @@
-
+
@@ -531,7 +544,7 @@
-
+
@@ -547,7 +560,7 @@
-
+
@@ -563,7 +576,7 @@
-
+
@@ -571,7 +584,7 @@
-
+
@@ -587,7 +600,7 @@
-
+
@@ -603,7 +616,7 @@
-
+
@@ -611,7 +624,7 @@
-
+
@@ -627,7 +640,7 @@
-
+
@@ -643,7 +656,7 @@
-
+
@@ -651,7 +664,7 @@
-
+
@@ -675,7 +688,7 @@
-
+
@@ -683,7 +696,7 @@
-
+
@@ -707,10 +720,34 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -731,31 +768,23 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
@@ -763,26 +792,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
diff --git a/index.html b/index.html
index 11b5887..13fff09 100644
--- a/index.html
+++ b/index.html
@@ -6,12 +6,13 @@
-
+
+
-
-
-
+
+
+
@@ -41,7 +42,7 @@
expressionInputCtrl.bind(document.getElementById('in'), model);
- app.command('calculateExpression').subscribe(function() {
+ app.command('calculateExpression', function() {
var expr = expression.parse(model.expression);
if(expr == null) {
diff --git a/js/app.js b/js/app.js
index 2ab6797..79ac2ec 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,11 +1,11 @@
-(function (should, bindr) {
+(function (should, commandr) {
var app = {};
app.views = {};
var servicesContainer = {};
var controllersContainer = {};
- var events = {};
+ var commands = {};
function resolveOrInject(name, inst, container, entityName) {
var resolved;
@@ -33,30 +33,22 @@
return resolveOrInject(name, inst, controllersContainer, "controller");
};
- app.command = function(name) {
- var evt = events[name];
- if(evt == null) {
- evt = events[name] = new Command(name);
+ app.command = function(name, handler) {
+ var cmd = commands[name];
+
+ if(cmd == null) {
+ cmd = commands[name] = new commandr.Command(name);
}
- return evt;
+
+ if(typeof handler == "function") {
+ cmd.subscribe(handler);
+ }
+
+ return cmd;
};
window.app = app;
- function Command(name) {
- this.name = name;
- this.handlers = [];
- }
- Command.prototype.fire = function (arg) {
- for(var i=0; i<1; i++) {
- this.handlers[i](arg);
- }
- };
- Command.prototype.subscribe = function (handler) {
- this.handlers.push(handler);
- // TODO: unsubcribe
- }
-
-})(window.should);
\ No newline at end of file
+})(window.should, window.commandr);
\ No newline at end of file
diff --git a/js/components/calc.js b/js/calc.js
similarity index 100%
rename from js/components/calc.js
rename to js/calc.js
diff --git a/js/components/commandr.js b/js/components/commandr.js
new file mode 100644
index 0000000..b3d2665
--- /dev/null
+++ b/js/components/commandr.js
@@ -0,0 +1,25 @@
+(function(){
+ var commandr = {
+
+ };
+
+ function Command(name) {
+ this.name = name;
+ this.handlers = [];
+ }
+
+ Command.prototype.fire = function (arg) {
+ for(var i=0; i<1; i++) {
+ this.handlers[i](arg);
+ }
+ };
+
+ Command.prototype.subscribe = function (handler) {
+ this.handlers.push(handler);
+ // TODO: unsubcribe
+ };
+
+ commandr.Command = Command;
+
+ window.commandr = commandr;
+})();
\ No newline at end of file
diff --git a/js/components/core.js b/js/components/should.js
similarity index 100%
rename from js/components/core.js
rename to js/components/should.js
diff --git a/js/components/expression.js b/js/expression.js
similarity index 100%
rename from js/components/expression.js
rename to js/expression.js
diff --git a/js/components/formatter.js b/js/formatter.js
similarity index 100%
rename from js/components/formatter.js
rename to js/formatter.js