From 78c422448a32c1b87f5f7ca44ae6e061879132bd Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Sun, 30 Mar 2014 14:17:40 -0400 Subject: [PATCH] make commonjs api work with non-global `module`, expose amd api --- mithril.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index 52939e69..368196cf 100644 --- a/mithril.js +++ b/mithril.js @@ -417,7 +417,8 @@ new function(window) { } } - if (window.module) window.module.exports = m + if (typeof module != "undefined" && module !== null) module.exports = m + if (typeof define == "function" && define.amd) define(function() {return m}) //testing API m.deps = function(mock) {return window = mock}