Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by riceje7

I am trying to use the jGestures jQuery plugin in a project i'm working on and when I try to run the app through Ejecta on my iPhone I get a TypeError upon importing the jQuery library:
2012-11-19 15:29:49.325 Stardom[12949:907] TypeError: 'undefined' is not a function (evaluating 'n.setAttribute("className","t")') at line 2 in lib/game/plugins/jquery-1.8.2.min.js

and then a ReferenceError on the jGestures saying it can't finds the jQuery variable:
2012-11-19 15:29:49.329 Stardom[12949:907] ReferenceError: Can't find variable: jQuery at line 18 in lib/game/plugins/jgestures.min.js

and finally I get another ReferenceError when I try using the jGesture library in my main.js:
2012-11-19 15:29:49.838 Stardom[12949:907] ReferenceError: Can't find variable: $ at line 5 in lib/game/main.js

I know what they all are saying, what i don't know is why jQuery won't load properly in Ejecta, however if i run the same code but in the context of my web browser on my laptop, everything loads all hunky-dory and the code runs as it should. Is there something about not being able to use other libraries like jQuery with Ejecta, that I don't know about or isn't in the docs? Any help would be greatly appreciated!

1 decade ago by dominic

Well, jQuery assumes it's running in a browser. It's main purpose is DOM manipulation and Ejecta has no DOM (or rather, only a very thin fake layer). So it's not surprising that it doesn't load.

I had a quick look at jGestures - it's quite a huge library. Detaching it from jQuery would be a lot of work.

So I guess your best bet would be to roll your own solution with the touchstart, touchmove and touchend events. For simple swipe gestures, this shouldn't be too difficult. What exactly do you need?

1 decade ago by riceje7

oh okay, with no DOM in Ejecta it does makes sense that it wouldn&039;t load. I was looking to implement some simple gestures (pinch-in/out, swipe-L/R/U/D, flick, and maybe one or two others. I had started by writing my own code with the #touchstart, touchmove and touchend but was getting inconsistent results trying to incorporate it as a module. Then I thought if i could extrapolate some of the coding work out and just use a library already created that it would be simpler. I&039;ll hack away at it a little more to see what I can do on my own, while i do that however, if i wanted to create an Impact module to use with Ejecta, how would i go about implementing it? All i'm looking for is basic skeletal structure of the module and how to call it my #main.js and have it work, I can figure out all the in between stuff i'm sure. Thanks Dominic.
Page 1 of 1
« first « previous next › last »