Allow Mithril to be loaded in non-browser environments without modification (#2633)

This commit is contained in:
Isiah Meadows 2020-10-14 03:12:47 -07:00 committed by GitHub
parent 3ad404039f
commit 045e4f720a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 4 deletions

View file

@ -36,6 +36,7 @@ PSA: changes to [`mithril/stream`](stream.md) are now specified in this changelo
- Fix issue where new redraw handlers weren't copied over on update. ([#2578](https://github.com/MithrilJS/mithril.js/pull/2578) [@isiahmeadows](https://github.com/isiahmeadows))
- Make changes to file inputs gracefully handled, and don't break if the current value and old value mismatch (and the new value isn't empty), but instead just log an error. ([#2578](https://github.com/MithrilJS/mithril.js/pull/2578) [@isiahmeadows](https://github.com/isiahmeadows))
- This mainly exists just to kick the can down the road - this is the only case I'm aware of where the DOM itself would be responsible for throwing an error. A proper fix to the greater issue of error handling is much more complex, and I'd rather not block users any longer over this one specific issue.
- Allow Mithril to be loaded in non-browser environments without modification. ([#2633](https://github.com/MithrilJS/mithril.js/pull/2633) [@isiahmeadows](https://github.com/isiahmeadows))
Important note: if you were using any of these undocumented tools, they are no longer available as of this release. This is not considered a breaking change as they were written for internal usage and as of v2 are all 100% unsupported in userland.

View file

@ -2,4 +2,4 @@
var render = require("./render")
module.exports = require("./api/mount-redraw")(render, requestAnimationFrame, console)
module.exports = require("./api/mount-redraw")(render, typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : null, typeof console !== "undefined" ? console : null)

View file

@ -1,3 +1,3 @@
"use strict"
module.exports = require("./render/render")(window)
module.exports = require("./render/render")(typeof window !== "undefined" ? window : null)

View file

@ -3,4 +3,4 @@
var PromisePolyfill = require("./promise/promise")
var mountRedraw = require("./mount-redraw")
module.exports = require("./request/request")(window, PromisePolyfill, mountRedraw.redraw)
module.exports = require("./request/request")(typeof window !== "undefined" ? window : null, PromisePolyfill, mountRedraw.redraw)

View file

@ -2,4 +2,4 @@
var mountRedraw = require("./mount-redraw")
module.exports = require("./api/router")(window, mountRedraw)
module.exports = require("./api/router")(typeof window !== "undefined" ? window : null, mountRedraw)