/*global Modernizr: true*/
var REIN = (function () {
    var modules = {}, events = {}, init, module, View;

    _.extend(events, Backbone.Events, {
        onMultiple: function (eNameToFnMap, ctx) {
            _.each(eNameToFnMap, function (fn, eventName) {
                this.on(eventName, fn, ctx);
            }, this);
        }
    });

    module = function (name) {
        if (modules[name]) {
            return modules[name];
        }

        modules[name] = { Views: {}, Models: {}, Collections: {} };
        return modules[name];
    };

    View = Backbone.View.extend({
        delegateEvents: function (events) {
            if (!(events || (events = this.events))) {
                return;
            }
            var key, tapEvents = _.extend({}, events);
            if (Modernizr.touch) {
                for (key in tapEvents) {
                    if (key.indexOf('click') > -1) {
                        tapEvents[key.replace('click', 'tap')] = tapEvents[key];
                        delete tapEvents[key];
                    }
                }
            }
            Backbone.View.prototype.delegateEvents.call(this, tapEvents);
        }
    });

    return {
        module: module,
        View: View,
        events: events
    };
}());

/*global Modernizr: true*/
var REIN = (function () {
    var modules = {}, events = {}, init, module, View;

    _.extend(events, Backbone.Events, {
        onMultiple: function (eNameToFnMap, ctx) {
            _.each(eNameToFnMap, function (fn, eventName) {
                this.on(eventName, fn, ctx);
            }, this);
        }
    });

    module = function (name) {
        if (modules[name]) {
            return modules[name];
        }

        modules[name] = { Views: {}, Models: {}, Collections: {} };
        return modules[name];
    };

    return {
        module: module,
        View: Backbone.View,
        events: events
    };
}());

Remove touch delay iPhone fix
Remove touch delay iPhone fix

Due to click event firing at touchend, the UX is kind of broken when scrolling
and the finger ends up on top of something 'clickable'.

Awaiting https://github.com/madrobby/zepto/pull/494
