Sha256: f2275b47a5a75980e6c494a226948be4eaddae3b4dbaa2c346693030ae2ada65

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

(function () {
  'use strict';

   angular.module('Thunderer', [])

     .factory('ThundererInterceptor', function ($q) {
       var self = {
         response: function (response) {
           var rawChanels = response.headers().channels;
           if (rawChanels) {
             var channels = JSON.parse(rawChanels);
             for (var i = 0; i < channels.length; i++) {
               Thunderer.sign(channels[i]);
             }
           }
           return response;
         },
         responseError: function (rejection) {
           $q.reject(rejection);
         }
       };

       return self;

     })

     .service('$thunderer', function () {

       var self = {
         addListener: function (channel, callback) {
           Thunderer.subscribe(channel, callback);
         },
         removeListener: function (channel) {
           Thunderer.unsubscribe(channel)
         },
         removeAllListners: function () {
           Thunderer.unsubscribeAll()
         }
       }
       return self;
     })

}());

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thunderer-1.1.0 app/assets/javascripts/thunderer_angular.js
thunderer-1.0.0 app/assets/javascripts/thunderer_angular.js
thunderer-0.9.1 app/assets/javascripts/thunderer_angular.js
thunderer-0.9.0 app/assets/javascripts/thunderer_angular.js