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

@nimiq/rpc

Package Overview
Dependencies
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nimiq/rpc - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

42

dist/rpc.common.js

@@ -352,13 +352,3 @@ 'use strict';

const data = message.data;
// Response handlers by id have priority to more general ones by command
let callback;
if (this._responseHandlers.has(data.id)) {
callback = this._responseHandlers.get(data.id);
}
else {
const command = this._waitingRequests.getCommand(data.id);
if (command) {
callback = this._responseHandlers.get(command);
}
}
const callback = this._getCallback(data.id);
const state = this._waitingRequests.getState(data.id);

@@ -383,2 +373,15 @@ if (callback) {

}
_getCallback(id) {
// Response handlers by id have priority to more general ones by command
if (this._responseHandlers.has(id)) {
return this._responseHandlers.get(id);
}
else {
const command = this._waitingRequests.getCommand(id);
if (command) {
return this._responseHandlers.get(command);
}
}
return undefined;
}
}

@@ -487,2 +490,5 @@ class PostMessageRpcClient extends RpcClient {

}
else {
this._rejectOnBack();
}
}

@@ -498,5 +504,19 @@ /* tslint:disable:no-empty */

this._waitingRequests.add(id, command, state);
history.replaceState({ rpcRequestId: id }, document.title);
console.debug('RpcClient REQUEST', command, args);
window.location.href = url;
}
_rejectOnBack() {
if (history.state && history.state.rpcRequestId) {
const id = history.state.rpcRequestId;
const callback = this._getCallback(id);
const state = this._waitingRequests.getState(id);
if (callback) {
this._waitingRequests.remove(id);
console.debug('RpcClient BACK');
const error = new Error('Request aborted');
callback.reject(error, id, state);
}
}
}
}

@@ -503,0 +523,0 @@

@@ -349,13 +349,3 @@ class RandomUtils {

const data = message.data;
// Response handlers by id have priority to more general ones by command
let callback;
if (this._responseHandlers.has(data.id)) {
callback = this._responseHandlers.get(data.id);
}
else {
const command = this._waitingRequests.getCommand(data.id);
if (command) {
callback = this._responseHandlers.get(command);
}
}
const callback = this._getCallback(data.id);
const state = this._waitingRequests.getState(data.id);

@@ -380,2 +370,15 @@ if (callback) {

}
_getCallback(id) {
// Response handlers by id have priority to more general ones by command
if (this._responseHandlers.has(id)) {
return this._responseHandlers.get(id);
}
else {
const command = this._waitingRequests.getCommand(id);
if (command) {
return this._responseHandlers.get(command);
}
}
return undefined;
}
}

@@ -484,2 +487,5 @@ class PostMessageRpcClient extends RpcClient {

}
else {
this._rejectOnBack();
}
}

@@ -495,5 +501,19 @@ /* tslint:disable:no-empty */

this._waitingRequests.add(id, command, state);
history.replaceState({ rpcRequestId: id }, document.title);
console.debug('RpcClient REQUEST', command, args);
window.location.href = url;
}
_rejectOnBack() {
if (history.state && history.state.rpcRequestId) {
const id = history.state.rpcRequestId;
const callback = this._getCallback(id);
const state = this._waitingRequests.getState(id);
if (callback) {
this._waitingRequests.remove(id);
console.debug('RpcClient BACK');
const error = new Error('Request aborted');
callback.reject(error, id, state);
}
}
}
}

@@ -500,0 +520,0 @@

@@ -354,13 +354,3 @@ (function (global, factory) {

const data = message.data;
// Response handlers by id have priority to more general ones by command
let callback;
if (this._responseHandlers.has(data.id)) {
callback = this._responseHandlers.get(data.id);
}
else {
const command = this._waitingRequests.getCommand(data.id);
if (command) {
callback = this._responseHandlers.get(command);
}
}
const callback = this._getCallback(data.id);
const state = this._waitingRequests.getState(data.id);

@@ -385,2 +375,15 @@ if (callback) {

}
_getCallback(id) {
// Response handlers by id have priority to more general ones by command
if (this._responseHandlers.has(id)) {
return this._responseHandlers.get(id);
}
else {
const command = this._waitingRequests.getCommand(id);
if (command) {
return this._responseHandlers.get(command);
}
}
return undefined;
}
}

@@ -489,2 +492,5 @@ class PostMessageRpcClient extends RpcClient {

}
else {
this._rejectOnBack();
}
}

@@ -500,5 +506,19 @@ /* tslint:disable:no-empty */

this._waitingRequests.add(id, command, state);
history.replaceState({ rpcRequestId: id }, document.title);
console.debug('RpcClient REQUEST', command, args);
window.location.href = url;
}
_rejectOnBack() {
if (history.state && history.state.rpcRequestId) {
const id = history.state.rpcRequestId;
const callback = this._getCallback(id);
const state = this._waitingRequests.getState(id);
if (callback) {
this._waitingRequests.remove(id);
console.debug('RpcClient BACK');
const error = new Error('Request aborted');
callback.reject(error, id, state);
}
}
}
}

@@ -505,0 +525,0 @@

@@ -16,2 +16,3 @@ import { ResponseMessage } from './Messages';

protected _receive(message: ResponseMessage): void;
protected _getCallback(id: number): ResponseHandler | undefined;
}

@@ -35,2 +36,3 @@ export declare class PostMessageRpcClient extends RpcClient {

callAndSaveLocalState(returnURL: string, state: string | null, command: string, ...args: any[]): void;
private _rejectOnBack;
}
{
"name": "@nimiq/rpc",
"version": "0.0.8",
"version": "0.0.9",
"description": "RPC Client/Server",

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

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