Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to use with another JQuery-based library #10

Open
spl opened this issue Aug 18, 2015 · 0 comments
Open

Failed to use with another JQuery-based library #10

spl opened this issue Aug 18, 2015 · 0 comments

Comments

@spl
Copy link

spl commented Aug 18, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant