Description
I apologize in advance for the poor description in this issue. I'm not really sure what the problem is, but I thought I would leave this here in case other people run into a similar problem.
I'm trying to use Flot, a JQuery-based library for plotting charts. If I use ghcjs-jquery
, the Flot code (jquery.flot.js
) does not load properly.** That is, it does not extend the jQuery
object with its functionality, such as adding a plot
function. If I use the simple FFI below (with a static jquery.js
and without using ghcjs-jquery
), the Flot code works. I only need selectElement
at this point.
type JQuery = JSRef JQuery_
data JQuery_
selectElement :: (MonadIO m, IsElement e) => e -> m JQuery
selectElement = liftIO . jq_selectElement . unElement . toElement
foreign import javascript unsafe "jQuery($1)" jq_selectElement :: JSRef Element -> IO JQuery
** Using ghcjs-jquery
, I have seen Flot work intermittently (once in a while on refresh). With only the above, it works consistently.
My guess is that the JavaScript loading is somehow causing the problem. Our output JS is relatively large.