Skip to content

Instantly share code, notes, and snippets.

@mahemoff
Created October 7, 2011 12:58
Show Gist options
  • Save mahemoff/1270230 to your computer and use it in GitHub Desktop.
Save mahemoff/1270230 to your computer and use it in GitHub Desktop.
Basic Support for CoffeeScript JSONP calls
importScripts 'jsonp-worker.coffee'
jsonp 'http://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=ev&callback=?', (response) ->
# process response
jsonp = (url, callback) ->
wrapper = "script#{Math.floor 1e16*Math.random()}"
self[wrapper] = callback
importScripts url.replace('=?', '='+wrapper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment