elm-canvas
elm-canvas copied to clipboard
Elm-Canvas references document, and in some contexts that doesnt exist
I was using Elm-Canvas in a project, when Elm-css started erroring with "document is not defined". My work around was adding this code:
var fakeDoc = {
createElement: function(){
return {
getContext: function() {
return {
drawImage: function(){},
beginPath: function(){},
rect: function(){},
fill: function(){},
}
}
};
}
};
var D = typeof document === "undefined" ? fakeDoc : document;