Socket
Socket
Sign inDemoInstall

bare-channel

Package Overview
Dependencies
8
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.0.1

34

index.js

@@ -15,7 +15,3 @@ /* global Bare */

this.destroyed = false
this.handle = handle
binding.channelRef(this.handle)
}

@@ -27,8 +23,2 @@

destroy () {
if (this.destroyed) return
this.destroyed = true
binding.channelDestroy(this.handle)
}
static from (handle, opts = {}) {

@@ -60,6 +50,3 @@ return new Channel({ ...opts, handle })

this.closed = false
this.remoteClosed = false
this.handle = binding.portInit(channel.handle, this,
this._id = binding.portInit(channel.handle, this,
this._ondrain,

@@ -71,2 +58,5 @@ this._onflush,

this.closed = false
this.remoteClosed = false
Port._ports.add(this)

@@ -100,3 +90,3 @@ }

if (this._buffer.length === 0) {
binding.portWait(this.handle)
binding.portWait(this._channel.handle, this._id)
this._onflush()

@@ -125,3 +115,3 @@ continue

if (this._closing !== null) return false
if (binding.portWrite(this.handle, data)) break
if (binding.portWrite(this._channel.handle, this._id, data.buffer)) break

@@ -152,3 +142,3 @@ if (this._drainedPromise === null) this._drainedPromise = new Promise(this._drainedQueue)

binding.portEnd(this.handle)
binding.portEnd(this._channel.handle, this._id)

@@ -159,3 +149,3 @@ if (!this.remoteClosed) await new Promise((resolve) => { this._onremoteclose = resolve })

const destroyed = new Promise((resolve) => { this._ondestroyed = resolve })
binding.portDestroy(this.handle)
binding.portDestroy(this._channel.handle, this._id)
await destroyed

@@ -171,3 +161,3 @@ this._ondestroyed = null

ref () {
binding.portRef(this.handle)
binding.portRef(this._channel.handle, this._id)
}

@@ -177,3 +167,3 @@

if (Bare.exiting) return // Unref'ed ports during exit is unsafe
binding.portUnref(this.handle)
binding.portUnref(this._channel.handle, this._id)
}

@@ -202,6 +192,6 @@

while (this._buffer.length < MAX_BUFFER) {
const data = binding.portRead(this.handle)
const data = binding.portRead(this._channel.handle, this._id)
if (data === null) return
const state = { start: 0, end: data.byteLength, buffer: data }
const state = { start: 0, end: data.byteLength, buffer: Buffer.from(data) }

@@ -208,0 +198,0 @@ const value = structuredClone.deserializeWithTransfer(structuredClone.decode(state))

{
"name": "bare-channel",
"version": "4.0.0",
"version": "4.0.1",
"description": "Inter-thread messaging for JavaScript",
"main": "index.js",
"exports": {
".": "./index.js"
},
"files": [

@@ -27,2 +29,5 @@ "index.js",

"homepage": "https://github.com/holepunchto/bare-channel#readme",
"engines": {
"bare": ">=1.2.0"
},
"dependencies": {

@@ -29,0 +34,0 @@ "bare-events": "^2.0.0",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc