Git Product home page Git Product logo

ghcjs-jquery's Introduction

ghcjs-jquery

jquery bindings for ghcjs

ghcjs-jquery's People

Contributors

adinapoli avatar basvandijk avatar bergey avatar cliffordbeshers avatar hamishmack avatar luite avatar mgsloan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghcjs-jquery's Issues

Uncaught ReferenceError: h$isNode is not defined

This is due to c5eeeaf and happens if GHCJS_BROWSER is defined. (I'm not really sure why nobody has reported this problem before. It could be something else about the way we're building our app, but I'm not really sure what that would be.)

Should the line be changed as follows?

-  if ( h$isNode ) return;
+  if (typeof h$isNode !== "undefined") return;

Prepend "on" before event handlers?

Consider blur - it's overloaded to either be a mutation or register an event handler. It is weird to me that the event handler thing is getting this name rather than the action, particularly as blur. To me, code with this reads really strangely without the on.

So, I'd say all jquery event registration things should start with on. I'm not changing this, for now. Maybe once improved-base stabilizes, stuff like this can get fixed up.

Failed to use with another JQuery-based library

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.

unreachable MVar problem - event handling stops after a while

event handling is implemented by having a thread block on an MVar that is passed to JS. GHCJS sends a 'Thread blocked indefinitely on an MVar operationto the thread now, since nothing in the Haskell world has another reference to thatMVar`, which means that no further events will be processed.

This makes much of this library rather useless, so it should really be fixed.

ghcjs-dom dependency is unbound, does not install with the latest version

In the cabal file, ghcjs-dom has no version range and cabal install fails because it tries to use 0.2.1.0. Works with the previous version ghcjs-dom-0.1.1.3.

src/GHCJS/DOM.hs:19:8:
    Could not find module ‘GHCJS.Types’
    It is a member of the hidden package ‘ghcjs-base-0.1.0.0’.
    Perhaps you need to add ‘ghcjs-base’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/EventTargetClosures.hs:9:8:
    Could not find module ‘GHCJS.Foreign.Callback.Internal’
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/JSFFI/Generated/ANGLEInstancedArrays.hs:12:8:
    Could not find module ‘GHCJS.Foreign’
    It is a member of the hidden package ‘ghcjs-base-0.1.0.0’.
    Perhaps you need to add ‘ghcjs-base’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/JSFFI/Generated/ANGLEInstancedArrays.hs:13:8:
    Could not find module ‘GHCJS.Foreign.Callback’
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/JSFFI/Generated/ANGLEInstancedArrays.hs:14:8:
    Could not find module ‘GHCJS.Marshal’
    It is a member of the hidden package ‘ghcjs-base-0.1.0.0’.
    Perhaps you need to add ‘ghcjs-base’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/JSFFI/Generated/ANGLEInstancedArrays.hs:15:8:
    Could not find module ‘GHCJS.Marshal.Pure’
    Perhaps you meant
      GHCJS.Marshal (needs flag -package ghcjs-base-0.1.0.0)
    Use -v to see a list of the files searched for.

-- Initial ghcjs-jquery.cabal generated by cabal init.  For further
src/GHCJS/DOM/JSFFI/Geolocation.hs:15:8:
    Could not find module ‘GHCJS.Prim’
    It is a member of the hidden package ‘ghcjs-prim-0.1.0.0’.
    Perhaps you need to add ‘ghcjs-prim’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/JSFFI/XMLHttpRequest.hs:18:8:
    Could not find module ‘GHCJS.Marshal.Internal’
    Perhaps you meant
      GHCJS.Prim.Internal (needs flag -package ghcjs-prim-0.1.0.0)
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/Types.hs:858:8:
    Could not find module ‘Data.JSString’
    Perhaps you meant Data.String (from base)
    Use -v to see a list of the files searched for.

src/GHCJS/DOM/Types.hs:859:8:
    Could not find module ‘Data.JSString.Text’
    Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
ghcjs-dom-0.2.1.0 failed during the building phase. The exception was:
ExitFailure 1

Event handler removal fails.

The following program should do nothing when the text is clicked, but the Ugh message appears anyway.

{-# LANGUAGE OverloadedStrings #-}

import Control.Monad (void)
import Data.Default
import Data.Text (Text)
import JavaScript.JQuery

default (Text)

main = do
body <- select "body"
button <- select "

Should do nothing when clicked.
"
response <- select "
Ugh, it did something.
"
appendJQuery button body
detach <- click (\e -> void $ appendJQuery response body) def button
detach
return ()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.