From 59c5039f3573ebb228294a112904faf63e28bf44 Mon Sep 17 00:00:00 2001 From: Oliver Sartun Date: Sat, 12 Jul 2014 11:55:22 +0200 Subject: [PATCH] Added AMD support --- Backbone.Undo.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Backbone.Undo.js b/Backbone.Undo.js index 839a62a..a662b16 100644 --- a/Backbone.Undo.js +++ b/Backbone.Undo.js @@ -9,12 +9,18 @@ */ -// AMD support (function (factory) { - typeof exports !== 'undefined' - ? (module.exports = factory) - : factory(_, Backbone); -})(function (_, Backbone, undefined) { + if (typeof define === "function" && define.amd) { + // AMD support + define(["underscore", "backbone"], factory); + } else if (typeof exports !== 'undefined') { + // CommonJS support + module.exports = factory; + } else { + // Non-modular execution + factory(_, Backbone); + } +})(function (_, Backbone) { var core_slice = Array.prototype.slice;