New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect.io

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect.io - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

26

dist/server.js

@@ -80,2 +80,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

function noop() {}
var Connection = (function () {

@@ -161,17 +163,17 @@

this.eventEmitter.on(eventName, function (data, id) {
var sent = undefined,
sendResponse = undefined;
if (id) {
(function () {
var sent = undefined;
cb(data, function (res) {
if (sent) {
console.warn('Event "' + eventName + '" was already response.');
return;
}
sent = true;
_this3.emit('Response for "' + eventName + '"', res, id);
});
})();
sendResponse = function (res) {
if (sent) {
console.warn('Event "' + eventName + '" was already response.');
return;
}
sent = true;
_this3.emit('Response for "' + eventName + '"', res, id);
};
} else {
cb(data);
sendResponse = noop;
}
cb(data, sendResponse);
});

@@ -178,0 +180,0 @@ }

@@ -5,2 +5,4 @@ import EventEmitter from 'events';

function noop() {}
class Connection {

@@ -64,5 +66,5 @@

this.eventEmitter.on( eventName , ( data , id )=> {
let sent , sendResponse;
if ( id ) {
let sent;
cb( data , res => {
sendResponse = res => {
if ( sent ) {

@@ -74,6 +76,7 @@ console.warn( `Event "${eventName}" was already response.` );

this.emit( `Response for "${eventName}"` , res , id );
} );
};
} else {
cb( data );
sendResponse = noop;
}
cb( data , sendResponse );
} );

@@ -80,0 +83,0 @@ }

{
"name": "connect.io",
"version": "0.0.2",
"version": "0.0.3",
"description": "chrome.runtime.connect wrapper that using Stock.IO API.",

@@ -5,0 +5,0 @@ "scripts": {

# connect.io
[chrome.runtime.connect](https://developer.chrome.com/extensions/runtime#method-connect) wrapper that using [Stock.IO API](http://socket.io/docs/).
[chrome.runtime.connect](https://developer.chrome.com/extensions/runtime#method-connect) wrapper that using [Socket.IO API](http://socket.io/docs/).

@@ -8,3 +8,3 @@ ## Install

```
npm i connect.io connect.io-client
npm i -S connect.io connect.io-client
```

@@ -19,8 +19,9 @@

<script>
const client = new ChromeClient('extensions id');
const client = new ChromeClient('optional extensions or apps id, default value is chrome.runtime.id');
client.on('welcome',(msg) => {
console.log(msg); // 'hello world'
console.log(msg); // 'hello world'
});
client.emit('report clients number', 'some arguments', (number) => {
// data can be omit
client.emit('report clients number', (number) => {
console.log(number); // 100

@@ -46,4 +47,4 @@ });

// Sending acknowledgements
connection.on('report clients number',(data, sendResponse) => {
console.log(data); // 'some arguments'
connection.on('report clients number', (data, sendResponse) => {
console.log(data); // when no data send to server, the data argument will be undefined
sendResponse(100);

@@ -50,0 +51,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc