From c6d57c7f53cedc514df376ca6ceb22b21a8ae0b2 Mon Sep 17 00:00:00 2001 From: jsguy Date: Sat, 13 Aug 2016 11:07:21 +1000 Subject: [PATCH] Set dependencies when no window for isomorphic compatibility --- mithril.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mithril.js b/mithril.js index ddc19a7c..0403d693 100644 --- a/mithril.js +++ b/mithril.js @@ -4,6 +4,15 @@ "use strict" /* eslint-disable no-undef */ var m = factory(global) + /* Set dependencies when no window for isomorphic compatibility */ + if(typeof window === "undefined") { + m.deps({ + document: typeof document !== "undefined"? document: {}, + location: typeof location !== "undefined"? location: {}, + clearTimeout: clearTimeout, + setTimeout: setTimeout + }); + } if (typeof module === "object" && module != null && module.exports) { module.exports = m } else if (typeof define === "function" && define.amd) {