You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like some changes made from String to JSStr broke at least this example.
I was just exploring haste / client side javascript generation from Haskell, and encountered this. I've created a patch for the one example I was working on.
I am not sure if this is the correct fix, but compiles and runs. Chrome run-time error "Tainted canvases may not be exported" occurred, but did not seem to impact testability outside the developer console.
This also includes changes to fix obsolete warning, on the getCanvas function.
From 67bb04da057f07177bb9982cc6da4863f4be63ff Mon Sep 17 00:00:00 2001
From: Trent Tobler <[email protected]>
Date: Sat, 17 Feb 2018 16:26:05 -0500
Subject: [PATCH] Fixed warnings and errors for the canvas sample when compiled
with 0.6.0.0 release.
---
examples/canvas/canvas.hs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/examples/canvas/canvas.hs b/examples/canvas/canvas.hs
index a7142a5..4aabe6f 100644
--- a/examples/canvas/canvas.hs
+++ b/examples/canvas/canvas.hs
@@ -3,6 +3,7 @@ import Haste
import Haste.DOM
import Haste.Events
import Haste.Graphics.Canvas
+import Haste.Prim
import Data.IORef
import Data.Array
import Data.Array.MArray
@@ -69,14 +70,14 @@ main = do
-- Setup: get the HTML element for a canvas, then proceed to create a canvas
-- object from it.
Just ce <- elemById "canvas"
- Just c <- getCanvas ce
+ Just c <- fromElem ce
-- Same for the canvas we're using as the tile "toolbox"
Just tilemapElem <- elemById "tiles"
- Just tiles <- getCanvas tilemapElem
+ Just tiles <- fromElem tilemapElem
-- Load our tileset from a PNG file.
- tileset <- loadBitmap "tileset.png"
+ tileset <- loadBitmap (toJSStr "tileset.png")
-- The tile toolbox is a tilemap in itself.
let allTiles = Tilemap {
@@ -126,4 +127,4 @@ drawEverything allTiles tiles c st = do
render c $ scale (2, 2) $ do
drawMap (tileMap st)
Just dataurl <- elemById "dataurl"
- toDataURL c >>= setProp dataurl "value"
+ toDataURL c >>= ( return . fromJSStr ) >>= setProp dataurl "value"
--
2.11.0.windows.1
The text was updated successfully, but these errors were encountered:
Looks like some changes made from String to JSStr broke at least this example.
I was just exploring haste / client side javascript generation from Haskell, and encountered this. I've created a patch for the one example I was working on.
I am not sure if this is the correct fix, but compiles and runs. Chrome run-time error "Tainted canvases may not be exported" occurred, but did not seem to impact testability outside the developer console.
This also includes changes to fix obsolete warning, on the getCanvas function.
The text was updated successfully, but these errors were encountered: