rxjs-websockets
Advanced tools
Comparing version 7.0.2 to 8.0.0
import { Observable } from 'rxjs'; | ||
declare type WebSocketPayload = string | ArrayBuffer | Blob; | ||
export interface IWebSocket { | ||
export interface WebSocketLike { | ||
close(): any; | ||
@@ -11,3 +11,3 @@ send(data: WebSocketPayload): any; | ||
} | ||
export declare type WebSocketFactory = (url: string, protocols: string | string[]) => IWebSocket; | ||
export declare type WebSocketFactory = (url: string, protocols: string | string[]) => WebSocketLike; | ||
export declare type GetWebSocketResponses<T = WebSocketPayload> = (input: Observable<WebSocketPayload>) => Observable<T>; | ||
@@ -14,0 +14,0 @@ export interface WebSocketOptions { |
@@ -12,2 +12,6 @@ import { Observable, Subject } from 'rxjs'; | ||
const messages = new Subject(); | ||
const socket = makeWebSocket(url, protocols); | ||
let isSocketOpen = false; | ||
let forcedClose = false; | ||
const setClosedStatus = () => { isSocketOpen = false; }; | ||
const getWebSocketResponses = (input) => { | ||
@@ -25,6 +29,2 @@ if (inputSubscription) { | ||
}; | ||
const socket = makeWebSocket(url, protocols); | ||
let isSocketOpen = false; | ||
let forcedClose = false; | ||
const setClosedStatus = () => { isSocketOpen = false; }; | ||
socket.onopen = () => { | ||
@@ -31,0 +31,0 @@ isSocketOpen = true; |
import { Observable } from 'rxjs'; | ||
declare type WebSocketPayload = string | ArrayBuffer | Blob; | ||
export interface IWebSocket { | ||
export interface WebSocketLike { | ||
close(): any; | ||
@@ -11,3 +11,3 @@ send(data: WebSocketPayload): any; | ||
} | ||
export declare type WebSocketFactory = (url: string, protocols: string | string[]) => IWebSocket; | ||
export declare type WebSocketFactory = (url: string, protocols: string | string[]) => WebSocketLike; | ||
export declare type GetWebSocketResponses<T = WebSocketPayload> = (input: Observable<WebSocketPayload>) => Observable<T>; | ||
@@ -14,0 +14,0 @@ export interface WebSocketOptions { |
@@ -15,2 +15,6 @@ "use strict"; | ||
var messages = new rxjs_1.Subject(); | ||
var socket = makeWebSocket(url, protocols); | ||
var isSocketOpen = false; | ||
var forcedClose = false; | ||
var setClosedStatus = function () { isSocketOpen = false; }; | ||
var getWebSocketResponses = function (input) { | ||
@@ -28,6 +32,2 @@ if (inputSubscription) { | ||
}; | ||
var socket = makeWebSocket(url, protocols); | ||
var isSocketOpen = false; | ||
var forcedClose = false; | ||
var setClosedStatus = function () { isSocketOpen = false; }; | ||
socket.onopen = function () { | ||
@@ -34,0 +34,0 @@ isSocketOpen = true; |
import { Observable } from 'rxjs'; | ||
declare type WebSocketPayload = string | ArrayBuffer | Blob; | ||
export interface IWebSocket { | ||
export interface WebSocketLike { | ||
close(): any; | ||
@@ -11,3 +11,3 @@ send(data: WebSocketPayload): any; | ||
} | ||
export declare type WebSocketFactory = (url: string, protocols: string | string[]) => IWebSocket; | ||
export declare type WebSocketFactory = (url: string, protocols: string | string[]) => WebSocketLike; | ||
export declare type GetWebSocketResponses<T = WebSocketPayload> = (input: Observable<WebSocketPayload>) => Observable<T>; | ||
@@ -14,0 +14,0 @@ export interface WebSocketOptions { |
@@ -13,2 +13,6 @@ import { Observable, Subject } from 'rxjs'; | ||
var messages = new Subject(); | ||
var socket = makeWebSocket(url, protocols); | ||
var isSocketOpen = false; | ||
var forcedClose = false; | ||
var setClosedStatus = function () { isSocketOpen = false; }; | ||
var getWebSocketResponses = function (input) { | ||
@@ -26,6 +30,2 @@ if (inputSubscription) { | ||
}; | ||
var socket = makeWebSocket(url, protocols); | ||
var isSocketOpen = false; | ||
var forcedClose = false; | ||
var setClosedStatus = function () { isSocketOpen = false; }; | ||
socket.onopen = function () { | ||
@@ -32,0 +32,0 @@ isSocketOpen = true; |
{ | ||
"name": "rxjs-websockets", | ||
"version": "7.0.2", | ||
"version": "8.0.0", | ||
"description": "rxjs 6 websockets library", | ||
@@ -24,11 +24,12 @@ "main": "lib.es5/index.js", | ||
"scripts": { | ||
"prepublish": "yarn build", | ||
"build": "tsc -p src/tsconfig.json && npm run build:es5 && npm run build:es5 -- -m es2015 --outDir lib.es5m", | ||
"prepublishOnly": "yarn build", | ||
"build": "yarn build:modern && yarn build:es5 && yarn build:es5 -m es2015 --outDir lib.es5m", | ||
"build:modern": "tsc -p src/tsconfig.json", | ||
"build:es5": "tsc -p src/tsconfig.es5.json", | ||
"build:watch": "tsc -w --preserveWatchOutput -p src/tsconfig.es5.json", | ||
"test": "npm run build && npm run mocha", | ||
"watch": "npm run build:es5 && concurrently 'npm run build:watch' 'npm run mocha:watch'", | ||
"prepare": "npm run build", | ||
"build:watch": "tsc -w -p src/tsconfig.es5.json", | ||
"lint": "eslint 'src/*.ts'", | ||
"test": "yarn build && yarn mocha", | ||
"watch": "yarn build:es5 && concurrently 'yarn build:watch' 'yarn mocha:watch'", | ||
"mocha": "mocha lib.es5/*.spec.js", | ||
"mocha:watch": "npm run mocha -- -w" | ||
"mocha:watch": "yarn mocha -w" | ||
}, | ||
@@ -41,14 +42,18 @@ "author": "James Pike <github@chilon.net>", | ||
"devDependencies": { | ||
"@types/chai": "4.1.7", | ||
"@types/chai": "4.2.3", | ||
"@types/mocha": "5.2.7", | ||
"@types/sinon": "7.0.13", | ||
"@types/sinon-chai": "3.2.2", | ||
"@types/sinon-chai": "3.2.3", | ||
"@typescript-eslint/eslint-plugin": "^2.3.0", | ||
"@typescript-eslint/parser": "^2.3.0", | ||
"chai": "4.2.0", | ||
"concurrently": "4.1.1", | ||
"mocha": "6.1.4", | ||
"rxjs": "6.5.2", | ||
"sinon": "7.3.2", | ||
"concurrently": "4.1.2", | ||
"eslint": "^6.4.0", | ||
"eslint-config-prettier": "^6.3.0", | ||
"mocha": "6.2.0", | ||
"rxjs": "6.5.3", | ||
"sinon": "7.4.2", | ||
"sinon-chai": "3.3.0", | ||
"typescript": "3.5.3" | ||
"typescript": "3.6.3" | ||
} | ||
} |
@@ -10,3 +10,3 @@ import 'mocha' | ||
import connect, { normalClosureMessage, IWebSocket } from '.' | ||
import connect, { normalClosureMessage, WebSocketLike } from '.' | ||
@@ -40,3 +40,3 @@ chai.use(sinonChai) | ||
const connectHelper = (mockSocket: IWebSocket, protocols: string | string[] = []) => | ||
const connectHelper = (mockSocket: WebSocketLike, protocols: string | string[] = []) => | ||
connect('url', { protocols, makeWebSocket: () => mockSocket }) | ||
@@ -43,0 +43,0 @@ |
@@ -14,3 +14,3 @@ import { Observable, Subscription, Subject } from 'rxjs' | ||
export interface IWebSocket { | ||
export interface WebSocketLike { | ||
close(): any | ||
@@ -28,3 +28,3 @@ send(data: WebSocketPayload): any | ||
export type WebSocketFactory = (url: string, protocols: string | string[]) => IWebSocket | ||
export type WebSocketFactory = (url: string, protocols: string | string[]) => WebSocketLike | ||
@@ -40,3 +40,3 @@ export type GetWebSocketResponses<T = WebSocketPayload> = ( | ||
protocols: string | string[], | ||
): IWebSocket => new WebSocket(url, protocols) | ||
): WebSocketLike => new WebSocket(url, protocols) | ||
@@ -65,2 +65,9 @@ export interface WebSocketOptions { | ||
const socket = makeWebSocket(url, protocols) | ||
let isSocketOpen = false | ||
let forcedClose = false | ||
const setClosedStatus = () => { isSocketOpen = false } | ||
const getWebSocketResponses: GetWebSocketResponses<T> = (input: Observable<WebSocketPayload>) => { | ||
@@ -78,9 +85,2 @@ if (inputSubscription) { | ||
const socket = makeWebSocket(url, protocols) | ||
let isSocketOpen = false | ||
let forcedClose = false | ||
const setClosedStatus = () => { isSocketOpen = false } | ||
socket.onopen = () => { | ||
@@ -87,0 +87,0 @@ isSocketOpen = true |
@@ -10,4 +10,5 @@ { | ||
"target": "es5", | ||
"preserveWatchOutput": true | ||
}, | ||
"include": ["."], | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
59339
29
758
15