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

jdefer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jdefer - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

2

package.json
{
"name": "jdefer",
"version": "0.0.10",
"version": "0.0.11",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "https://github.com/tranvansang/jdefer",

@@ -11,2 +11,4 @@ # Javascript promise defer library

## Single promise with defer
```typescript

@@ -28,1 +30,38 @@ import makeDefer from 'jdefer'

```
## Broadcast stream
```typescript
import {makeBroadcastStream} from 'jdefer'
// or
const {makeBroadcastStream} = require('jdefer')
const stream = makeBroadcastStream()
// to listen
const removeListener = stream.listen(
(value) => {
console.log(value)
}, {
onDone() {
console.log('done')
},
onError(error) {
console.error(error)
},
})
// to stop listening
removeListener()
// to broadcast
stream.next('foo')
// to broadcast error
stream.throw(new Error('bar'))
// to broadcast done
stream.done()
// iterate
for await (const value of stream) {
console.log(value)
}
```
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