elm-canvas icon indicating copy to clipboard operation
elm-canvas copied to clipboard

Elm-Canvas references document, and in some contexts that doesnt exist

Open Chadtech opened this issue 6 years ago • 0 comments

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; 

Chadtech avatar Mar 05 '18 00:03 Chadtech