This is an incomplete list! If you find a listing for "Multithreaded JavaScript: Concurrency Beyond the Event Loop" in your favourite bookstore, please leave a comment or DM @bengl on Twitter to have it added here.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [MAJOR, MINOR] = process.versions.node.split('.').map(Number) | |
let testCommand = 'node --test' | |
if (MAJOR >= 22 || (MAJOR === 20 && MINOR >= 1) || (MAJOR === 18 && MINOR >= 17)) { | |
testCommand = 'node --experimental-test-coverage --test' | |
} else if (MAJOR >= 20 || (MAJOR === 18 && MINOR >= 1)) { | |
testCommand = 'node --test' | |
} else if (MAJOR >= 18) { | |
testCommand = 'node_modules/.bin/node--test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http-next' | |
import fs from 'fs' | |
const server = http.createServer({ | |
allowHTTP1: true, | |
allowHTTP2: true, | |
allowHTTP3: true, | |
key: fs.readFileSync('localhost-privkey.pem'), | |
cert: fs.readFileSync('localhost-cert.pem') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pitesti from 'https://dev.jspm.io/pitesti' | |
import streams from 'https://dev.jspm.io/readable-stream' | |
import { assertEquals } from "https://deno.land/std/testing/asserts.ts" | |
const outputStream = new streams.Writable({ | |
write (data, encoding, cb) { | |
Deno.stdout.writeSync(data) | |
cb() | |
} | |
}) |
This is an example app that has been bundled with qbundler
.
It's a bundled version of https://github.com/bengl/qbundler/tree/master/testapp.
You can try this yourself!
Just npm i -g qdd
, then download this JS file and run it. A server will be running after it quickly downloads its dependencies, like magic!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try running this file with: | |
// | |
// npx -p bengl/qdd qdd-node qdd-cowsay-demo.js | |
// | |
// `qdd-node` will read the package-lock data below, use it to install the | |
// dependencies to the qdd cache, then run this file with a shimmed module | |
// loader that will load from the qdd cache! | |
// | |
// This would also work with an ordinary package-lock.json file in the $PWD. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Readable } = require('stream'); | |
const oldOn = Readable.prototype.on; | |
Readable.prototype.on = function on(name, fn) { | |
oldOn.apply(this, arguments); | |
if (name !== 'allData' || this._readableState.objectMode) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try running this file in Node 8.2.1 | |
// Try running this file in Node 8.3.0 | |
// Try running this file in d8 for Node 8.3.0 | |
function empty() {} | |
let i, j, d; | |
for(j = 0; j < 5; j++) { | |
d = Date.now(); | |
for (i = 0; i < 1e7; i++) { |
TODO
- Download the "full" bin file from here https://drive.google.com/drive/folders/0B0iF4l2rag1dZm9IWTVJbWkyQkE?usp=sharing
- Install it on the Kimax device via the web interfact (note: I had some trouble with this due to CSS shenanigans).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "This works!" |
NewerOlder