Skip to content

Commit

Permalink
added initial README notes for v0.1
Browse files Browse the repository at this point in the history
added version number to jojo object
normalized namespaces to camel case and classes to upper case
  • Loading branch information
Ryan Gahl committed Dec 3, 2009
1 parent dc1f12f commit 289f81b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
v0.1 NOTES -----------

- lowercased all namespaces, upper case for classes
- created github repository
- committed first skeleton code
1 change: 1 addition & 0 deletions core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var jojo = MojoJojo = {
version: "0.1",
/**
* Simple incremental ID provider for cases where the developer wants to rely on the framework to auto ID stuff
*/
Expand Down
14 changes: 7 additions & 7 deletions event.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
/**
* Root namespace for custom event publishing/subscribing/dispatching services
*/
jojo.ns("jojo.Event");
jojo.ns("jojo.event");

/**
* The EventPublisher class allows objects to fire events (and other objects to
* subscribe handlers to those events). The events can be fired either
* synchronously or asynchronously (depending on how the handlers register themselves),
* and may pass optional arguments to the handlers.
*/
jojo.Event.EventPublisher = Class.create();
jojo.event.EventPublisher = Class.create();

//private methods ------------------------------------
/**
Expand All @@ -28,7 +28,7 @@
eventObj = Object.extend({
fireGlobal: false // set true to fire as a global event after firing locally
}, eventObj);
if (eventPublisher === jojo.Event.EventDispatcher) {
if (eventPublisher === jojo.event.EventDispatcher) {
eventObj.fireGlobal = false; //already at the global level... having true here would result in an infinite loop
}
var handlers = new jojo.lang.Registry(true, false, "Error: Event handlers must have a unique id property (one will auto generate if you don't specify one)");
Expand All @@ -43,7 +43,7 @@
});
}

jojo.Event.EventPublisher.prototype = {
jojo.event.EventPublisher.prototype = {
/**
* @constructor
*/
Expand Down Expand Up @@ -313,13 +313,13 @@
});
}
oneShotHandlers.each(function(handler) {
if (me.removeEventHandler) {// support the possibility that dispose() was called in an even handler
if (me.removeEventHandler) {// support the possibility that the object was deconstructed during the event
me.removeEventHandler(eventName, handler);
}
});
//optionally fire globally
if (this.eventCache && this.eventCache[eventName].fireGlobal) {
jojo.Event.EventDispatcher.fire(eventName, args); //TODO: some sort of automatic (or manual) namespacing?
jojo.event.EventDispatcher.fire(eventName, args); //TODO: some sort of automatic (or manual) namespacing?
}
}
}
Expand Down Expand Up @@ -364,6 +364,6 @@
* Global event dispatcher object for wide spread broadcasting and generic subscriptions.
* This facilitates greater de-coupling where publishers and subscribers need not know about each other.
*/
jojo.Event.EventDispatcher = new jojo.Event.EventPublisher();
jojo.event.EventDispatcher = new jojo.event.EventPublisher();

})();
2 changes: 1 addition & 1 deletion game.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
game.fire("gameLoopEnd");
}

WW.game = Class.create(WW.Event.EventDispatcher, {
jojo.Game = Class.create(jojo.event.EventDispatcher, {
frameDelay: 30,
initialize: function($super, options) {
$super(options);
Expand Down
2 changes: 1 addition & 1 deletion lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jojo.lang.Registry.prototype = {
}
this.fireEvents = fireEvents;
if (this.fireEvents) {
Object.extend(this, new jojo.Event.EventPublisher());
Object.extend(this, new jojo.event.EventPublisher());
}
},
/**
Expand Down

0 comments on commit 289f81b

Please sign in to comment.