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

Spine JS + JQuery Mobile + Ajax Request #33

Open
grigio opened this issue Mar 7, 2012 · 6 comments
Open

Spine JS + JQuery Mobile + Ajax Request #33

grigio opened this issue Mar 7, 2012 · 6 comments

Comments

@grigio
Copy link

grigio commented Mar 7, 2012

Ciao,
do you have an example with your router and Spine JS?
Grazie

@azicchetti
Copy link
Owner

Ciao,
uhm, not yet, but I'd like to add one soon.
If you're willing to try and write something, I'll happily add it to the repository.

A presto,
Andrea

@grigio
Copy link
Author

grigio commented Mar 15, 2012

Grazie per la risposta,
unfortunatly am not a so js ninja.

I tried built a basic app via hem/nodejs but it is very clear to me the correct lib loading

@grigio
Copy link
Author

grigio commented Mar 15, 2012

This is a basic Spine Loading, which libraries does your routing replace? I think manager and router, but I don't know how to integrate it. Any tips?

require('json2ify')
require('es5-shimify')
require('jqueryify')

require('spine')
require('spine/lib/local')
require('spine/lib/ajax')
require('spine/lib/manager')
require('spine/lib/route')
require('spine/lib/tmpl')

Do I need to disable something? https://gist.github.com/2044082

@azicchetti
Copy link
Owner

I think it replaces route (as a consequence, manager becomes useless).
As long as you use spine for its models and views and react to jquery mobile events through the jqm router, you should be fine.

You don't have to disable anything in the mobileinit event, default settings are fine

@sukima
Copy link
Contributor

sukima commented Oct 6, 2012

So I'm am very interested in also integrating Spine with JQM. I would be more then happy to make a sample app if not a tutorial and share it when complete. However, I would need some help getting started. Maybe a quick overview between JQM design and Spine design and their differing conflicts.

If anyone is interested in chatting or offering some guidance on where to get started I can at least finish with a working example you can add to the documentation.

@azicchetti
Copy link
Owner

Hi @sukima
although I don't know much about spine, I'm quite used to jQM and backbone.js and I know the problems you have to solve to successfully integrate them.

The biggest issue is that jQM has a built-in routing system based on hashes (pushState is also supported) that conflicts with the one provided by backbone and spine.

In addition, jQM provides a lot of useful page-related events that cannot be exploited using a standard hashchange router.

Some folks prefer to disable jQM routing completely and use it as a mobile UI library: this is fine, some things will be probably prove a little more difficult since you have to do a lot of things "by hand".

Alternatively you can keep jQM internal routing and do away with backbone/spine routing plugins.
The only requisite is a perfect understanding of the events exposed by jQM ( http://jquerymobile.com/demos/1.2.0/docs/api/events.html ).
To tap into jQM routing you have to use events; unfortunately, manually binding handlers to page divs or to the document object is somehow difficult, error prone and time consuming.
Some plugins were written to simplify this task and this project is one of them.

To sum everything up, plugins such as the jquerymobile router try to provide the same functionality (or a big subset) of backbone and spine routers by using jQM events, exposing them to the developer in the process.

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

3 participants