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

@fine-js/channels

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fine-js/channels - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

browser.js

7

CHANGELOG.md
# Changelog
## Version `0.0.2` from May 16, 2020
A build for browsers is available. Read more [here](README.md#browsers).
## Version `0.0.1` from April 26, 2020
[First](https://www.npmjs.com/package/@fine-js/channels/env/v/0.0.1) release
published to [npm](https://www.npmjs.com/package/@fine-js/channels)
First release published to [npm](https://www.npmjs.com/package/@fine-js/channels)
with base functionality:

@@ -8,0 +11,0 @@

{
"name": "@fine-js/channels",
"version": "0.0.1",
"version": "0.0.2",
"description": "Bits of Clojure's `core.async` ported to JS",

@@ -19,2 +19,3 @@ "author": "Aleksei Zabrodskii <elmigranto@protonmail.com> (https://elmigranto.me/)",

"files": [
"browser.js",
"src/buffers.js",

@@ -27,3 +28,9 @@ "src/chan.js",

"scripts": {
"pre-publish": "yarn lint && yarn test",
"prepublishOnly": "yarn lint && yarn test && yarn build",
"build": "yarn build-it && yarn --silent run build-info | xargs",
"build-it": "browserify --plugin browser-pack-flat src/index.js | terser --enclose --compress --mangle > browser.js",
"build-info": "echo \"$(yarn --silent build-size && yarn --silent build-hash)\" | xargs",
"build-hash": "shasum --binary --algorithm 384 browser.js | awk '{ print $1 }' | xxd -r -p | base64 | xargs -I hash echo sha384-hash",
"build-size": "wc -c browser.js | xargs",
"buildw": "nodemon --watch src/ --exec yarn run build",
"test": "mocha src/*.test.js",

@@ -34,7 +41,12 @@ "testw": "nodemon --watch src/ --exec yarn test",

"devDependencies": {
"@fine-js/eslint-config": "^1.1.2",
"browser-pack-flat": "^3.4.2",
"browserify": "^16.5.1",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"lodash": "^4.17.15",
"mocha": "^7.1.2",
"nodemon": "^2.0.3"
"nodemon": "^2.0.4",
"terser": "^4.6.13"
}
}

@@ -20,2 +20,38 @@ # Channels.js

## Supported Platforms
Library's source code is plain JavaScript with no runtime dependencies that works in Node.js
and modern browsers.
### Node.js
After installing a dependency, `require` the module as usual:
```js
const {chan} = require('@fine-js/channels')
console.dir(chan())
```
### Browsers
A build for browsers is available as a [single-file download](browser.js)
and via [UNPKG](https://unpkg.com/browse/@fine-js/channels/) ([docs](https://unpkg.com)).
Here is an example of embedding version `0.0.2` in particular:
```html
<script src="https://unpkg.com/@fine-js/channels@0.0.2/browser.js"
integrity="sha384-aLUgfMcOf6P0qxZ4k0e084VdlxfruOqU0zXhYBSZS28Y07u7Zoo1NBbYnNpNynck"
crossorigin="anonymous"></script>
<script>
const {chan} = window.finejs.channels
console.dir(chan())
</script>
```
Alternatively, you can build your own version with [Browserify](http://browserify.org)
or any other bundler, as well as serve `require.resolve('@fine-js/channels/browser.js')`
from your server directly.
## Overview

@@ -22,0 +58,0 @@

'use strict'
const {buffer, unbuffered} = require('./buffers')
const {badval, valueError, once, privates} = require('./misc')
const {badval, valueError, once, privates, schedule} = require('./misc')
const {max} = Math
const schedule = setImmediate

@@ -8,0 +7,0 @@ const nextTicker = (() => {

@@ -12,1 +12,8 @@ 'use strict'

}
if (typeof window === 'object') {
/* eslint-env browser */
window.finejs = window.finejs || {}
window.finejs.channels = module.exports
/* eslint-env node */
}

@@ -20,2 +20,11 @@ 'use strict'

// In node, we'd like to use setImmediate, but since browsers do not support it,
// we have to go with `setTimeout` of 0 milliseconds. We access `setImmediate`
// like we do, so that Browserify does not include its `timers` module.
const schedule = ((browser) => {
return browser
? (fn, ...args) => void setTimeout(fn, 0, ...args)
: global['set' + 'Immediate'] // eslint-disable-line no-useless-concat
})(typeof window === 'object')
module.exports = {

@@ -26,2 +35,3 @@ privates: Symbol('channels/private-apis'),

once,
schedule,
}
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