

Building SoundCloud Mobile with Backbone.js - jashkenas
http://backstage.soundcloud.com/2011/08/building-the-soundcloud-mobile-site-using-backbone-js/

======
Pewpewarrows
> A common and frustrating use-case was mobile Twitter: Someone would share a
> new favorite or upload on Twitter, you tap on it, and it tried to load the
> regular site on your tiny smartphone screen. Pushing the whole desktop site
> over a mobile connection would be a waste of precious bandwidth, if you only
> want to check out a track. Alternatively we could try to redirect to our
> native apps, but there’s no guarantee that the user has it installed and the
> mobile vendors don’t offer any APIs for verifying that in advance.

Somewhat off-topic, but for any devs interested: Android allows you to do
that. From your native app, you can essentially hook into whenever the user
tries to open a URL that looks like your site (soundcloud.com, etc), and
through the Intent system the OS will offer the user the option of opening
that URL through your application. From there you can parse the URL, see what
they were trying to look at, and dive deep into the app to whatever screen
(Activity) makes sense for that content.

Here's an example from StackOverflow:
[http://stackoverflow.com/questions/2448213/how-to-
implement-...](http://stackoverflow.com/questions/2448213/how-to-implement-my-
very-own-uri-schema-on-android/2448531#2448531)

I'm not as familiar with iOS, so I don't know if something similar exists for
that environment.

------
jashkenas
A question for the Matas and the SoundCloud folks: If you upgraded to Backbone
0.5.0+, would you use the built-in pushState support, or would you still need
additional functionality that your custom routing provides?

~~~
jzaefferer
Upgrade to 0.5.x is on the roadmap, along with some other housekeeping. That
should replace our custom backbone-history completely, just need a way to
trigger an event on pushState that other components can handle.

------
meta
I am very curious about this: "To implement the remaining presentation logic,
we used the route suggested by Backbone.js, preparing the data for output in
the Model’s toJSON method."

I don't quite know why you would toJSON the model for the view vs. just
accessing the models members via .escape() when you need them. Has anyone else
used the toJSON function to format models for output to a view?

~~~
jzaefferer
We use that for example for formatting a timestamp into an "5 hours ago"
format.

