diff --git a/index.html b/index.html
index a2f56b7..2437cfb 100644
--- a/index.html
+++ b/index.html
@@ -85,8 +85,8 @@
This is a proposal
-
-
+
+
diff --git a/js/cuore/Cuore.Bus.js b/js/cuore/Cuore.Bus.js
index bb91f5c..5070b2c 100644
--- a/js/cuore/Cuore.Bus.js
+++ b/js/cuore/Cuore.Bus.js
@@ -25,16 +25,14 @@ CUORE.Bus = (function(undefined) {
}
function unsubscribe(subscriber, events) {
- var i;
-
if (typeof events == "string") {
_removeSubscription(_createSubscription(subscriber, events));
return;
}
- for (i = 0; i < events.length; i++) {
- _removeSubscription(_createSubscription(subscriber, events[i]));
- }
+ events.forEach(function (event) {
+ _removeSubscription(_createSubscription(subscriber, event));
+ });
}
function hasSubscriptions() {
@@ -42,31 +40,28 @@ CUORE.Bus = (function(undefined) {
}
function subscribers(theEvent) {
- var selectedSubscribers = [],
- i, subscription,
- len = subscriptions.length;
+ var selectedSubscribers = [];
- for (i = 0; i < len; i++) {
- subscription = subscriptions[i];
+ subscriptions.forEach(function (subscription) {
if (subscription.eventName === theEvent) {
selectedSubscribers.push(subscription.subscriber);
}
- }
+ });
+
return selectedSubscribers;
}
function emit(eventName, params) {
- var subscribersList = this.subscribers(eventName),
- i, len = subscribersList.length;
+ var subscribersList = this.subscribers(eventName);
debug("Bus.emit (event, params)");
debug(eventName);
debug(params);
debug("------------");
- for (i = 0; i < len; i++) {
- subscribersList[i].eventDispatch(eventName, params);
- }
+ subscribersList.forEach(function (current) {
+ current.eventDispatch(eventName, params);
+ });
}
function debug(object) {
@@ -100,12 +95,16 @@ CUORE.Bus = (function(undefined) {
for (i = 0; i < len; i++) {
if (theSubscription.equals(subscriptions[i])) {
- subscriptions.splice(i, 1);
+ this._removeAt(subscriptions, i);
return;
}
}
}
+ function _removeAt (index, array) {
+ array.splice(index, 1);
+ }
+
function _validSubscriber(subscriber) {
return subscriber.eventDispatch;
}
diff --git a/js/cuore/Cuore.Journey.js b/js/cuore/Cuore.Journey.js
index b30db63..e5707a0 100644
--- a/js/cuore/Cuore.Journey.js
+++ b/js/cuore/Cuore.Journey.js
@@ -2,11 +2,14 @@ CUORE.Journey = CUORE.Class(null, {
init: function(start, end) {
var allValues = (start && end);
+ var minutesInADay;
this.itsGranularity = 60;
this.minutesInAnHour = 60;
+ minutesInADay = 24 * this.minutesInAnHour;
+
this.start = (allValues) ? this._convertToMinutesDay(start) : 0;
- this.end = (allValues) ? this._convertToMinutesDay(end) : 1440;
+ this.end = (allValues) ? this._convertToMinutesDay(end) : minutesInADay;
},
starts: function() {
diff --git a/js/new_cuore/Cuore.Service.js b/js/new_cuore/Service.js
similarity index 100%
rename from js/new_cuore/Cuore.Service.js
rename to js/new_cuore/Service.js
diff --git a/js/new_cuore/Cuore.Services.Label.js b/js/new_cuore/Services.Label.js
similarity index 100%
rename from js/new_cuore/Cuore.Services.Label.js
rename to js/new_cuore/Services.Label.js