angular-pusher
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -93,3 +93,3 @@ /** | ||
if (callback) callback(data); | ||
$rootScope.$broadcast(channel + ':' + eventName, data); | ||
$rootScope.$broadcast(channelName + ':' + eventName, data); | ||
$rootScope.$digest(); | ||
@@ -101,2 +101,2 @@ }); | ||
} | ||
]); | ||
]); |
@@ -1,1 +0,1 @@ | ||
"use strict";angular.module("doowb.angular-pusher",[]).provider("PusherService",function(){function createScript($document,callback){var tag=$document.createElement("script");tag.type="text/javascript",tag.async=!0,tag.id=scriptId,tag.src=scriptUrl,tag.onreadystatechange=tag.onload=function(){var state=tag.readState;callback.done||state&&!/loaded|complete/.test(state)||(callback.done=!0,callback())},$document.getElementsByTagName("head")[0].appendChild(tag)}var scriptUrl="//js.pusher.com/2.1/pusher.min.js",scriptId="pusher-sdk",apiKey="",initOptions={};this.setPusherUrl=function(url){return scriptUrl=url||scriptUrl,this},this.setOptions=function(options){return initOptions=options||initOptions,this},this.setToken=function(token){return apiKey=token||apiKey,this},this.$get=["$document","$timeout","$q","$rootScope","$window",function($document,$timeout,$q,$rootScope,$window){function onSuccess(){pusher=new $window.Pusher(apiKey,initOptions)}var pusher,deferred=$q.defer(),onScriptLoad=function(){onSuccess(),$timeout(function(){deferred.resolve(pusher)})};return createScript($document[0],onScriptLoad),deferred.promise}]}).factory("Pusher",["$rootScope","PusherService",function($rootScope,PusherService){return{subscribe:function(channelName,eventName,callback){PusherService.then(function(pusher){var channel=pusher.channel(channelName)||pusher.subscribe(channelName);channel.bind(eventName,function(data){callback&&callback(data),$rootScope.$broadcast(channel+":"+eventName,data),$rootScope.$digest()})})}}}]); | ||
"use strict";angular.module("doowb.angular-pusher",[]).provider("PusherService",function(){function createScript($document,callback){var tag=$document.createElement("script");tag.type="text/javascript",tag.async=!0,tag.id=scriptId,tag.src=scriptUrl,tag.onreadystatechange=tag.onload=function(){var state=tag.readState;callback.done||state&&!/loaded|complete/.test(state)||(callback.done=!0,callback())},$document.getElementsByTagName("head")[0].appendChild(tag)}var scriptUrl="//js.pusher.com/2.1/pusher.min.js",scriptId="pusher-sdk",apiKey="",initOptions={};this.setPusherUrl=function(url){return scriptUrl=url||scriptUrl,this},this.setOptions=function(options){return initOptions=options||initOptions,this},this.setToken=function(token){return apiKey=token||apiKey,this},this.$get=["$document","$timeout","$q","$rootScope","$window",function($document,$timeout,$q,$rootScope,$window){function onSuccess(){pusher=new $window.Pusher(apiKey,initOptions)}var pusher,deferred=$q.defer(),onScriptLoad=function(){onSuccess(),$timeout(function(){deferred.resolve(pusher)})};return createScript($document[0],onScriptLoad),deferred.promise}]}).factory("Pusher",["$rootScope","PusherService",function($rootScope,PusherService){return{subscribe:function(channelName,eventName,callback){PusherService.then(function(pusher){var channel=pusher.channel(channelName)||pusher.subscribe(channelName);channel.bind(eventName,function(data){callback&&callback(data),$rootScope.$broadcast(channelName+":"+eventName,data),$rootScope.$digest()})})}}}]); |
{ | ||
"name": "angular-pusher", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "brian.woodward@gmail.com" |
@@ -0,0 +0,0 @@ Version numbers correspond to `bower.json` version |
@@ -10,3 +10,3 @@ { | ||
"name": "angular-pusher", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -13,0 +13,0 @@ "homepage": "", |
@@ -0,0 +0,0 @@ # angular-pusher [![NPM version](https://badge.fury.io/js/angular-pusher.png)](http://badge.fury.io/js/angular-pusher) |
Sorry, the diff of this file is not supported yet
113
6742