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

rxws

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxws - npm Package Compare versions

Comparing version 3.2.2 to 3.3.0

27

lib/request.js

@@ -12,2 +12,4 @@ 'use strict';

exports.requestUse = requestUse;
exports.startMockingRequests = startMockingRequests;
exports.stopMockingRequests = stopMockingRequests;
exports.default = makeRequest;

@@ -21,2 +23,3 @@

var isConnected = false;
var mockRequests = null;
var requestQueue = [];

@@ -218,2 +221,20 @@ var requestMap = {};

/**
* If executed with a callback, no requests will actually made to the server
* instead the callback will be executed with the request object that would
* have been sent to the server.
*
* @param {Function} cb the callback that will be executed
*/
function startMockingRequests(cb) {
mockRequests = cb;
}
/**
* Stop mocking requests.
*/
function stopMockingRequests() {
mockRequests = null;
}
function makeRequest(config) {

@@ -224,2 +245,8 @@ if (!backend) throw new Error('Must define a websocket backend');

var request = (0, _utils.generateRequestObject)(defaultHeaders)(config);
if (mockRequests) {
// return so we don't proceed with making the actual server request
return mockRequests(request);
}
if (isConnected) {

@@ -226,0 +253,0 @@ sendRequest(request);

5

lib/rxws.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});

@@ -49,2 +49,5 @@

_request2.default.startMockingRequests = _request.startMockingRequests;
_request2.default.stopMockingRequests = _request.stopMockingRequests;
exports.default = _request2.default;

2

package.json
{
"name": "rxws",
"version": "3.2.2",
"version": "3.3.0",
"description": "A RESTful reactive JavaScript implmentation on top of web sockets",

@@ -5,0 +5,0 @@ "main": "lib/rxws.js",

@@ -6,2 +6,3 @@ import { Observable } from 'rx';

let isConnected = false;
let mockRequests = null;
let requestQueue = [];

@@ -206,2 +207,20 @@ let requestMap = {};

/**
* If executed with a callback, no requests will actually made to the server
* instead the callback will be executed with the request object that would
* have been sent to the server.
*
* @param {Function} cb the callback that will be executed
*/
export function startMockingRequests(cb) {
mockRequests = cb;
}
/**
* Stop mocking requests.
*/
export function stopMockingRequests() {
mockRequests = null;
}
export default function makeRequest(config) {

@@ -212,2 +231,8 @@ if (!backend) throw new Error('Must define a websocket backend');

let request = generateRequestObject(defaultHeaders)(config);
if (mockRequests) {
// return so we don't proceed with making the actual server request
return mockRequests(request);
}
if (isConnected) {

@@ -214,0 +239,0 @@ sendRequest(request);

@@ -8,3 +8,10 @@ import remove from './remove';

import makeRequest, { setBackend, onNotification, use, requestUse } from './request';
import makeRequest, {
setBackend,
onNotification,
use,
requestUse,
startMockingRequests,
stopMockingRequests
} from './request';

@@ -23,2 +30,5 @@ makeRequest.remove = remove;

makeRequest.startMockingRequests = startMockingRequests;
makeRequest.stopMockingRequests = stopMockingRequests;
export default makeRequest;
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