angular-websocket
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -44,4 +44,4 @@ ;(function(module, undefined) { | ||
states: ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'], | ||
on: function(event) { | ||
return addListener(event); | ||
on: function(event, callback) { | ||
return addListener(event)(callback); | ||
}, | ||
@@ -75,3 +75,4 @@ onmessage: addListener('message'), | ||
args = Array.prototype.slice.call(arguments); | ||
return ws.removeListener.apply(ws, args); | ||
ws.removeEventListener.apply(ws, args); | ||
return this; | ||
}, | ||
@@ -92,11 +93,13 @@ | ||
events.forEach(function(eventName) { | ||
var prefixed = _prefix + eventName; | ||
var forwardEvent = asyncAngularify(function (data) { | ||
scope.$broadcast(prefixed, data); | ||
var prefixedEvent = _prefix + eventName; | ||
var forwardEvent = asyncAngularify(function(data) { | ||
scope.$broadcast(prefixedEvent, data); | ||
}); | ||
scope.$on('$destroy', function () { | ||
ws.removeListener(eventName, forwardEvent); | ||
ws.removeEventListener(eventName, forwardEvent); | ||
}); | ||
ws.onmessage(eventName, forwardEvent); | ||
}); | ||
return this; | ||
} | ||
@@ -103,0 +106,0 @@ }; |
{ | ||
"name": "angular-websocket", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/gdi2290/angular-websocket", | ||
@@ -5,0 +5,0 @@ "authors": [ |
{ | ||
"name": "angular-websocket", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "angular-websocket.js", | ||
@@ -5,0 +5,0 @@ "description": "WebSocket service for Angular.js", |
@@ -17,3 +17,3 @@ # angular-websocket [![Build Status](https://travis-ci.org/gdi2290/angular-websocket.png?branch=master)](https://travis-ci.org/gdi2290/angular-websocket) | ||
````html | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.min.js"></script> | ||
<script src="app/bower_components/angular-websocket/angular-websocket.js"></script> | ||
@@ -36,2 +36,3 @@ <script> | ||
console.log('connection'); | ||
WebSocket.send('message') | ||
}); | ||
@@ -38,0 +39,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11459
176
48