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
Hello, I'm using the threepenny library for a code editor based on the codemirror library.
I have the following function that expects a CodeMirror editor object as input and get's triggered by pressing STR+ENTER while the editor is selected.
getValue :: JSObject -> UI String
getValue cm = callFunction $ ffi "(%1).getValue()" cm
it can apperently happen, that sometimes the argument is 'undefined' so I tried something like this:
getValue :: JSObject -> UI String
getValue cm = callFunction $ ffi "(function (a) { if (typeof a === 'undefined' || a === null) {console.log(\"hm1\"); return \"\";} else {console.log(\"okk\"); return a.getValue(); } })(%1)" cm
But this will sometimes throw
haskell.js:359 Uncaught TypeError: Cannot convert undefined or null to object
at Object.Haskell.freeStablePtr (haskell.js:359:22)
at eval (eval at receive (haskell.js:266:11), <anonymous>:1:9)
at receive (haskell.js:266:11)
at WebSocket.ws.onmessage (haskell.js:108:9)
The annoying thing is that it is not very easy to reproduce this, as it doesn't occur very often. But when it occurs it's very annoying because it crashes the editor.
I unfortunatley don't have a lot of experience with JavaScript, so I'm hoping that someone here can help me out.
The text was updated successfully, but these errors were encountered:
Hello, I'm using the threepenny library for a code editor based on the codemirror library.
I have the following function that expects a CodeMirror editor object as input and get's triggered by pressing STR+ENTER while the editor is selected.
it can apperently happen, that sometimes the argument is 'undefined' so I tried something like this:
But this will sometimes throw
The annoying thing is that it is not very easy to reproduce this, as it doesn't occur very often. But when it occurs it's very annoying because it crashes the editor.
I unfortunatley don't have a lot of experience with JavaScript, so I'm hoping that someone here can help me out.
The text was updated successfully, but these errors were encountered: