Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pbkit/wrp

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pbkit/wrp - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

glue/child-window.js

@@ -39,3 +39,3 @@ "use strict";

function messageHandler(e) {
if (e.source !== parent)
if (e.source !== child)
return;

@@ -42,0 +42,0 @@ if (!(0, web_1.isGlueEvent)(e))

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createParentWindowSocket = void 0;
const observer_1 = require("@pbkit/runtime/async/observer");
const index_1 = require("./index");

@@ -12,3 +13,4 @@ const web_1 = require("./misc/web");

throw new Error("Invalid parent window.");
let handshakeIsDone = false;
const wait = (0, observer_1.defer)();
let acked = false;
globalThis.addEventListener("message", messageHandler);

@@ -19,2 +21,3 @@ globalThis.addEventListener("message", handshakeHandler);

syn();
await wait;
return {

@@ -41,2 +44,3 @@ read: glue.read,

onClosed === null || onClosed === void 0 ? void 0 : onClosed();
wait.reject(new Error("Connection closed."));
}

@@ -53,3 +57,3 @@ function syn() {

function ack() {
handshakeIsDone = true;
acked = true;
const success = (0, web_1.postGlueHandshakeMessage)({

@@ -60,3 +64,5 @@ target: parent,

});
if (!success)
if (success)
wait.resolve();
else
close();

@@ -79,3 +85,3 @@ }

if (payload === "syn-ack") {
if (handshakeIsDone)
if (acked)
close();

@@ -82,0 +88,0 @@ else

{
"name": "@pbkit/wrp",
"version": "0.1.3",
"version": "0.1.4",
"author": "JongChan Choi <jong@chan.moe>",

@@ -5,0 +5,0 @@ "license": "(MIT OR Apache-2.0)",

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