Skip to content

Commit

Permalink
build v1.0.0-rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
Derick Bailey committed Jan 27, 2013
1 parent 1939802 commit ccde589
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
43 changes: 13 additions & 30 deletions lib/backbone.marionette.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,26 +207,25 @@ Backbone.ChildViewContainer = (function(Backbone, _){
return Container;
})(Backbone, _);

// Backbone.Wreqr, v0.2.0
// Copyright (c)2012 Derick Bailey, Muted Solutions, LLC.
// Backbone.Wreqr, v0.1.1
// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
// http://github.com/marionettejs/backbone.wreqr
Backbone.Wreqr = (function(Backbone, Marionette, _){
"option strict";
"use strict";
var Wreqr = {};

// Handlers
// --------
// A registry of functions to call, given a name

Wreqr.Handlers = (function(Backbone, _){
"option strict";
"use strict";

// Constructor
// -----------

var Handlers = function(){
"use strict";
this._handlers = {};
};

Expand Down Expand Up @@ -284,7 +283,7 @@ Backbone.Wreqr = (function(Backbone, Marionette, _){
// A simple command pattern implementation. Register a command
// handler and execute it.
Wreqr.Commands = (function(Wreqr){
"option strict";
"use strict";

return Wreqr.Handlers.extend({
execute: function(){
Expand All @@ -303,7 +302,7 @@ Backbone.Wreqr = (function(Backbone, Marionette, _){
// A simple request/response implementation. Register a
// request handler, and return a response from it
Wreqr.RequestResponse = (function(Wreqr){
"option strict";
"use strict";

return Wreqr.Handlers.extend({
request: function(){
Expand All @@ -322,32 +321,16 @@ Backbone.Wreqr = (function(Backbone, Marionette, _){
// of an application through event-driven architecture.

Wreqr.EventAggregator = (function(Backbone, _){
"use strict";
var EA = function(){};

// Grab a reference to the original listenTo
var listenTo = Backbone.Events.listenTo;

// Create a version of listenTo that allows contexting binding
function contextBoundListenTo(obj, evtSource, events, callback, context){
context = context || obj;
return listenTo.call(obj, evtSource, events, _.bind(callback, context));
}

// Define the EventAggregator
function EventAggregator(){}

// Mix Backbone.Events in to it
_.extend(EventAggregator.prototype, Backbone.Events, {
// Override the listenTo so that we can have a version that
// correctly binds context
listenTo: function(evtSource, events, callback, context){
return contextBoundListenTo(this, evtSource, events, callback, context);
}
});
// Copy the `extend` function used by Backbone's classes
EA.extend = Backbone.Model.extend;

// Allow it to be extended
EventAggregator.extend = Backbone.Model.extend;
// Copy the basic Backbone.Events on to the event aggregator
_.extend(EA.prototype, Backbone.Events);

return EventAggregator;
return EA;
})(Backbone, _);


Expand Down
Loading

0 comments on commit ccde589

Please sign in to comment.