build/src/transistor-radio.js in transistor-0.1.1 vs build/src/transistor-radio.js in transistor-0.1.2
- old
+ new
@@ -12,11 +12,11 @@
*
* JSONP.get( 'someUrl.php', {param1:'123', param2:'456'}, function(data){
* //do something with data, which is the JSON object you should retrieve from someUrl.php
* });
*/
-var JSONP = (function(){
+var JSONP = function(){
var counter = 0, head, window = this, config = {};
function load(url, pfnError) {
var script, done, errorHandler;
script = document.createElement('script');
@@ -80,11 +80,11 @@
}
return {
get:jsonp,
init:setDefaults
};
-}());
+};
/*global JSONP, Faye */
if (window.Transistor === undefined) {
window.Transistor = {};
}
@@ -92,18 +92,20 @@
(function (transistor) {
var Radio = (function () {
return function (station_finder, station_uid, token, cache) {
- var init_url, bayeux, listeners, turnOn, error, tune, build_channel_path;
+ var jsonp, init_url, bayeux, listeners, turnOn, error, tune, build_channel_path;
+ jsonp = JSONP();
+
init_url = station_finder + '/init/' + station_uid + '/' + token;
listeners = [];
turnOn = function () {
var initial_value;
- JSONP.get(init_url, {}, function (init) {
+ jsonp.get(init_url, {}, function (init) {
if (init.error !== undefined) {
error(init);
}
bayeux = new Faye.Client(init.aerial_url, { retry: 3 });