trying to popularize #responsivity and teach people about #latency: “You’ve probably come across a website where scrolling stutters now and then, a button responds slightly late, or the letters you type into a search box show up half a beat behind. It isn’t bad enough to be annoying, but it gets on your nerves in a subtle way. That kind of jank is what a blocked main thread looks like. (...) web performance metrics. INP (Interaction to Next Paint), which measures how long it takes for the screen to respond after the user does something, and TBT (Total Blocking Time), which measures the total time the main thread was blocked during page load”
Includes details that I didn’t know about setTimeout and something called MessageChannel in #JS. Doesn’t mention web workers, though.
#Yt-dlp is abandoning the #Bun #JS runtime because #Anthropic has discarded the old #Zig codebase and switched to #Rust generated by #AI #LLMs. “As of the next yt-dlp and/or ejs release, only Bun versions 1.2.11 through 1.3.14 will be supported.” #neural-networks
on 02026-05-22#Bellard shrank down his QuickJS interpreter for #JS for microcontroller use. #toread
on 02026-01-06#JS eval is crazy
on 02025-12-03discussion of how #yt-dlp now requires #Deno for #JS to work reliably on #YouTube
on 02025-11-11apparently in #JS the new Symbol.toPrimitive method makes it possible to, in effect, implement operator overloading of | to make a pipeline?
#introduction #tutorial to #Cedarling (in Wasm) in #JS. “To perform an authorization check, follow these steps:” #security #toread
on 02025-10-02"SmallJS" is #Smalltalk in #JS #toread
on 02025-08-27#JS #datetime handling defaults to midnight UTC, which is 9 AM in Japan
on 02025-07-30nanboxing and nunboxing in #JS #virtual-machine implementation techniques
on 02025-03-28Auditable & minimal #JS implementation of Salsa20, ChaCha, Poly1305 & AES-SIV #small-is-beautiful #cryptography #NaCl
on 02025-03-16"Moddable" is a free-software #JS engine (ES2023) for #microcontrollers like ESP8266, ESP32, Raspberry Pi Pico, nRF52, etc. Its JS engine is called “XS”.
on 02024-12-27#Performance of different #JS engines about 10 years ago, comparing #QuickJS to #Duktape, V8, plus two other lightweight JS implementations, #JerryScript and #MuJS, and apparently things called Hermes and XS (#Moddable?). Taking V8 as the baseline, roughly, V8 --jitless is 22× slower, QuickJS and Hermes are 37× slower, Duktape is 88× slower, XS is 56× slower, MuJS is 260× slower, and JerryScript failed to run most of the tests.
on 02024-12-27"QuickJS" is a free-software #JS engine (ES2023) designed for lightweight embedding. 210 KiB of x86 code, 300μs life cycle. “Can compile Javascript sources to executables with no external dependency.”
on 02024-12-27"Duktape" is an embeddable #JS engine (ES5.1 with some ES2015 stuff) in under 200kB of code, comparable to Lua, capable of running with under 2kB of RAM
on 02024-12-27"fast-check" is the popular property-based #testing library for #JS (displacing JSVerify) and for #TypeScript too. It supports shrinking but seems not to use Hypothesis’s insights. Maybe it’s better, who knows.
on 02024-12-22a pretty three.js shader making firework #graphics #shaders #JS
on 02024-11-13#Electron’s “remote” module was another #JS #security blunder.
on 02024-07-05discussion of alternative ways to store user settings in #Electron #JS.
on 02024-07-05Aha, the reason #Electron has “preload” is because originally you couldn’t load modules in your renderer pages. This covers the #security implications a bit. #JS
on 02024-07-05"Lovefield" is a relational database in #JS for browser apps providing “SQL-like syntax”.
on 02024-07-05Another question about how to use sqlite3 with #Electron; mentions in passing how to use other modules. #JS
on 02024-07-05To use a Node native module, such as sqlite3, with #Electron, you generally need to rebuild it for use with Electron (which is generally pretty easy, a single command with a couple of npm dependencies). You generally can’t use the normally-compiled Node module. It used to work with electron-builder, but it’s been abandoned. #JS
on 02024-07-05#Electron used to have two separate ways to build executables, electron-packager and electron-builder, but electron-packager was the one that survived. electron-forge grew around it. #JS
on 02024-07-05console.log() works in #Electron #JS but on Microsoft Windows you have to set ELECTRON_ENABLE_LOGGING=1 to see it in your console window
how to do file uploads to #Electron apps in React with Redux. #JS
on 02024-07-05On Linux and Microsoft Windows you can set an #Electron app window icon with an option when you open the window, but not on macOS. #JS
on 02024-07-05apparently #Electron uses an archiver called asar? #JS
on 02024-07-05How to hide the menu bar in #Electron apps. #JS
on 02024-07-05Supposedly the ultimate #Electron #JS guide. #toread
on 02024-07-05Recent versions of #Electron don’t expose Node.js functions in the browser window (since version 5), but you can set webPreferences.nodeIntegration to true and contextIsolation to false if you’re willing to accept the risk. But the recommended approach is to pass stuff back and forth with ipcRenderer and ipcMain. Some of the answers have extensive histories of Electron #security. #JS
old versions of jQuery, d3, etc., tried to be smart about #CommonJS modules, which caused problems with loading them in #Electron; there’s a simple hack here for convincing them that they’re not being loaded in a CommonJS environment, if I understand correctly. #JS
on 02024-07-05#JS got #bignum support ("BigInt") in about 02019 in Chrome 67 and Opera 54, but polyfills are impossible.
on 02024-03-24#Proxy #membrane #interposition pattern in #JS
on 02024-02-06How #Facebook disabled the #Chromium #JS console in 02013 (as an anti-self-xss #security measure) until the Chromium team fixed it
on 02023-12-06rails or django in 02021? apparently adonisjs.com is a 1:1 clone of Laravel for #Typescript or maybe #JS; #NestJS, Blitz (RIP), #Sveltekit, #Hapi (RIP), and #Sails are also mentioned
on 02023-11-26some hoops to jump through to get #Emscripten #wasm to load in #React #JS
on 02023-06-24#Golang's #JS integration via #wasm actually looks pretty usable.
on 02023-06-23apparently you can create #Web-workers from localhost HTTP URLs, but not file:// URLs, and in I guess Chromium not data: URLs, but you can create Blob URLs in #JS. If HTTP or HTTPS, the MIME type has to be text/javascript. #browsers
on 02023-06-22Explanation of #Web-workers in #JS. Normally it's like const w = new Worker('worker.js'), where worker.js defines an onmessage callback which can use a postMessage global to send back too its creator, who can handle it by setting w.onmessage to the appropriate callback. There's a synchronous, blocking importScripts in the worker that takes URLs oof libraries to load. Runtime errors invoke onerror. #browsers
This is where the #Emscripten docs explain how to read #wasm memory from #JS with Module.HEAPU8.set(myTypedArray, ptr) or getValue(ptr, type) or setValue(ptr, value, type).
A different way to enable C compiled with #Emscripten to call #JS is to add JS functions to library.js or LibraryManager.library and pass your JS to emcc with the option --js-library. This seems like a potentially cleaner way to handlle the JS/C split for APIs that have to cross the boundary.
This is the guide for calling #JS from C (#Wasm) using EM_JS, EM_ASM, etc. Apparently with EM_ASM you are not supposed to use doublequotes!
#Emscripten exports Module.ccall and Module.cwrap functions to #JS for calling into #Wasm code.
#Emscripten has an emscripten_set_main_loop function you're supposed to run in order to get #JS to call your C code from requestAnimationFrame or periodically.
#Emscripten has an emscripten_run_script function to eval arbitrary #JS generated by the C it compiled! Unless -sDYNAMIC_EXECUTION=0 is set.
#Emscripten supports writing #JS functions in your C with EM_JS. If the arguments are int32_t, double, or NUL-terminated C strings, it translates them for you automatically, but pointers are treated as integers the JS can index HEAP8, HEAPU8, HEAP32, etc., with. String return values get malloced. There's also EM_ASM for inline JS, which has some trouble with commas that can be worked around with extra parens. EM_ASM_INT, EM_ASM_PTR, etc., also permit return values.
#Web-workers can transfer so-called "transferable objects" to other “agents” in the “cluster” without copying them by listing them in an array passed as a second argument to postMessage; the ArrayBuffer in .buffer of typed arrays like Uint8Array is such a transferable object, as are things like MessagePort, AudioData, and WritableStream. Agents are web workers or the DOM execution context. #JS #wasm #browsers
on 02023-06-22Justin Meiners’s advocacy for #optimization, using the Nelder-Mead #algorithm in #JS and using drawn figure recognition as the example problem
on 02022-05-21#JS #bytebeat #music with explanation
on 02022-05-21use el.BoundingClientRect() to find the actual size of an #SVG element in #JS
on 02022-05-21the #supply-chain #security #backdoor to steal #bitcoin was in the #npm #JS package flatmap-stream
on 02021-12-14Crockford’s explanation of the Pratt #top-down-operator-precedence #parsing algorithm; Crockford presents a #JS parser that can parse the JS subset it’s written in, cut down from his JSlint. #algorithms #smallisbeautiful
on 02021-01-21dictionary iteration order is a covert channel in #JS #security
on 02020-11-12Mozilla has a #JS #FFI called "js-ctypes" which is not the same as node-ffi.
on 02019-02-15Don Hopkins explains why #X11 is horrible and why you should write your window manager in #JS. #UX
on 02019-02-05Don Hopkins on how we ought to implement X window managers in #JS in a browser runtime #UX
on 02019-02-05how to use fragment #shaders in #WebGL in three.js #JS #Shadertoy #graphics
on 02018-10-13the internals of SpiderMonkey. #JS #compilers
on 02018-10-05“Perform massively parallel #GPGPU computations using #WebGL.” This sounds super awesome, although it’s doing this goofy pseudo-#JS parsing thing. Unfortunately their benchmark only gets a 7× speedup on this laptop, which is less than what you’d expect going from JS to e.g. C++, Golang, or Rust on the CPU.
on 02017-07-11"Stardust": #GPGPU in #JS for data #visualization with a D3-like API, complementary to D3.
on 02017-06-17A #VNC client in a couple hundred lines of #JS.
on 02017-06-17#Tutorial on getting started with a modern #JS stack of React, Redux, React Router, Flow (Flowtype), ESLint, Jest, Yarn, Webpack, and Bootstrap. Also Node, Husky, Immutable, HMR, Fetch, server-side rendering, Helmet, Socket.IO, JSS, Travis, Coveralls, Atom, and Heroku.
on 02017-05-11discussion thread on how the Glimmer VM (which #Ember-JS uses for rendering #JS templates) gets high #performance
on 02017-05-11"user.space" is a #decentralized #JS SPA thing
on 02017-05-11#JS #ebook series aimed at language lawyers
on 02017-05-02Alternatives for #React #JS: Redux vs. Flux.
on 02017-04-29the new version of #TypeScript allows you to put your type annotations in comments so you can use TypeScript on regular #JS
on 02017-04-28Steve Yegge’s explanation in 2007 of why #JS was going to be the next big language, along with the definition of “Go Ugly Early”: “#1 C-like syntax. #2 Dynamic typing with optional static types. #3 Performance. #4 Tools. #5 Kitchen Sink: 1. Object-literal syntax for arrays and hashes; 2. Array slicing and other intelligent collection operators; 3. Perl 5 compatible regular expression literals; 4. Destructuring bind (e.g. x, y = returnTwoValues()); 5. Function literals and first-class, non-broken closures; 6. Standard OOP with classes, instances, interfaces, polymorphism, etc.; 7. Visibility quantifiers (public/private/protected); 8. Iterators and generators; 9. List comprehensions; 10. Namespaces and packages; 11. Cross-platform GUI; 12. Operator overloading; 13. Keyword and rest parameters; 14. First-class parser and AST support; 15. Static typing and duck typing; 16. Type expressions and statically checkable semantics; 17. Solid string and collection libraries; 18. Strings and streams act like collections. #6 Multi-Platform.”
on 02017-04-14scrolling #performance and why it kind of sucks in #browsers and how to improve it in your #JS, e.g. with passive listeners. #UX
on 02017-03-22#JS setTimeout has a minimal delay these days — he says it’s 4ms but I get more like 8ms
on 02016-11-23"KLIPSE" supports live-coding in-browser client-side evaluation of PHP, ClojureScript, Ruby (Opal), #JS, Python (Skulpt, a #JS reimplementation of Python 2), and Scheme (BiwaScheme), using CodeMirror for the editor. GPLv3.
on 02016-11-23"KLIPSE" supports live-coding in-browser client-side evaluation of PHP, ClojureScript, Ruby (Opal), #JS, Python (Skulpt, a #JS reimplementation of Python 2), and Scheme (BiwaScheme), using CodeMirror for the editor. GPLv3.
on 02016-11-23The #Lua #virtual-machine compiled to #JS (or maybe asm.js?) with Emscripten runs at 64% of native speed in Firefox. Maybe useful for #explorable-explanations. Suffers from memory leaks at the FFI between Emscripten and JS.
on 02016-11-23The ClojureScript compiler from #Clojure to #JS is now self-hosting.
on 02016-11-23Opal is a compiler from #Ruby to #JS, e.g. for #explorable-explanations.
on 02016-11-23Uniter is a #JS implementation of #PHP, e.g. for #explorable-explanations.
on 02016-11-23BiwaScheme is a #JS implementation of #Scheme, including call/cc, with most of R7RS and a bunch of SRFIs, e.g. for #explorable-explanations.
on 02016-11-23Skulpt is a JS reimplementation of #Python 2 for in-browser evaluation, e.g. for #explorable-explanations. It compiles Python to #JS with an AST as its intermediate representation.
on 02016-11-23on how the #JS ecosystem is intimidating and clumsy
on 02016-10-03#JS #emulation of the crappy Sinclair Radionics #calculator “Sinclair Scientific”, which ran on the same TMS0800 four-function calculator chip #hardware as the TI Datamath.
on 02016-10-03#emulation of the Datamath #calculator (running on the 4-bit TMS0800 CPU #hardware with a ROM of 320 11-bit words) from 1974 in #JS, with live disassembly from the patent (US 3,934,233), and a DHTML register display.
on 02016-10-03#Content-addressable #JS frameworks via the new SRI “#subresource-integrity” feature (<script integrity="sha-...">). “explores why content addressable caching is difficult on the Web platform, and how #browsers might sidestep these difficulties” such as timing leaks. Pretty sad, but it does suggest some feasible solutions that sound safe. #security
#screencasting #video of writing a version of Pong in #JS with <canvas> in 5’30" #video-games
"Viral.JS" (“viraljs” on npm) is a #p2p system in #JS (using #WebRTC) for turning browsers into a #CDN for your web app. It’s implemented as middleware for the “Express” framework.
on 02016-08-01this is the smallest #JS #raytracer, at 959 bytes. Rendering takes under 10 seconds on my netbook. #smallisbeautiful
on 02016-07-12this is the prettiest #JS #raytracer, by Micah Elizabeth Scott, and it uses #asmjs, but it’s 2D. #Monte-Carlo
on 02016-07-12a #raytracer using #asmjs. #JS
on 02016-07-12a #Monte-Carlo #raytracer in #JS. Doesn’t work very well — fast, but poor visual quality.
on 02016-07-12The current #benchmarks used for developing the #V8 #JS engine include a #raytracer.
on 02016-07-12Real-time (18fps on my netbook) #raytracer in #JS, using <canvas>
the SpiderMonkey #JS #bytecode representation. It’s a stack machine.
on 02016-07-11Oh hey, The CommonMark #Markdown dialect has a reference implementation in #JS for live editing in browsers. (And another one in C.) Naturally, it supports all the HTML block stuff; not sure if there’s a way to whitelist tags and URL schemes to avoid XSS #security problems.
on 02016-07-05#History of the early days of #JS, plus some stuff about Java and Strongtalk and Hotspot and Blackburn and whatnot, an #interview with Brendan Eich (transcript and #audio)
on 02016-06-30#JS didn’t have block scope, only function scope, in order to make it easier to implement, and also because other “scripting languages” (which I guess in this case means Tcl and maybe Python) did the same.
on 02016-06-29Brendan’s comments from 2012 on the #JS #leading-commas controversy and Crockford being a whiny child about JSMin
on 02016-06-21Details of #SIMDjs #performance in #Mozilla #JS
on 02016-01-08#Chromium doesn’t yet enable #SIMDjs by default in its #JS as of 2015-11-14.
on 02016-01-08The #spec and a polyfill for #SIMDjs being proposed for the #JS standard.
on 02016-01-08#Chromium plans to implement #SIMDjs in its #JS interpreter, including support for TypedArrays of SIMD values.
on 02016-01-08the old #JS TypedArray #spec used in #canvas (at least on Firefox), now part of ECMAScript
on 02016-01-08the #JS call to blit image data from something resembling a TypedArray onto a #canvas. Doesn’t support scaling!
on 02016-01-08#introduction to improving #JS #performance with #canvas
on 02016-01-08Edgar Aroutiounian wrote a compiler from #OCaml to #JS for node.js. #compilers
on 02015-12-03Tessel is a 180MHz #ARM Cortex-M3 LPC1830 board with 32MB of SDRAM and 32MB of Flash that you can program in #JS.
on 02015-11-26Espruino is a STMicroelectronics #ARM Cortex-M3 #microcontroller board that runs #JS for US$25, or US$40 from Adafruit. Reputedly you can run the Espruino firmware on #NodeMCU boards.
on 02015-11-26a #constraint solver and #optimizer for systems of #nonlinear equations using #Haskell to implement #gradient-descent, using #automatic-differentiation, compiled to #JS using Haste and drawn with #d3, equations rendered with MathJax. Some of the visualizations don’t work for me. Most of the examples are #kinematics. By the author of #Antimony!
on 02015-10-25#JS #semantics in a core JS, by Arjun Guha, Claudiu Saftoiu (??), and Shriram Krishnamurthi. Their core “λJS” is block-scoped and has side effects (computed property assignment expressions), with a Felleisen-Hieb small-step semantics, but not variable mutation or statement sequencing. It elides constant-property access e.x but not object literals {x:e} in favor of computed lookup. #bootstrapping #pdf
PDF.js renders PDF files in pure #JS, which could maybe be embedded into a JS application, for e.g. collaborative annotation.
on 02015-09-09A #JS footnote library that does mouseover popups.
on 02015-08-27#syntax-highlighting in #JS for DHTML, with pluggable themes and syntaxes, including ARM and x86 assembly, OpenSCAD, DNS zone files, Prolog, Fortran, SML, OCaml, Verilog, Less, Tcl, erb, Scheme, G-Code, Kx q, Nix, Clojure, and of course Python, JS, Markdown, HTML, Java, C++, ObjC, SQL, and Ruby.
on 02015-08-27another somewhat confusing #JS API
on 02015-08-25#hash #performance #benchmark in #JS. MurmurHash gets 14k ops/sec in my Firefox; MD5 only 687; SipHash only 1589; and the equivalent of Java string hashCode() 12k.
on 02015-08-23#bcrypt in pure #node #JS has #performance of 108ms with rounds=9 (which really means 2⁹ rounds) on a 3GHz CPU; a C++ version takes 76ms. It would probably make sense to use 13 or 14 nowadays, as a result, unless you’re running bcrypt on your smartphone.
on 02015-08-18you can run #Node #JS and #Python code in #AWS #Lambda sandboxes, not just JVM stuff!
on 02015-08-17The BLKC4777 #demo. Apparently won the 1024-bytes-and-under category at Assembly this year? And it’s in #JS? #smallisbeautiful
on 02015-08-16How to tell where someone has clicked on a page in #JS mouse #events because the DOM sucks, as of 2015, by #ppk. Again, sadly, he’s getting page X and Y, not canvas X and Y. Also, this covers event properties in general.
on 02015-08-15How to tell where someone has clicked on a page in #JS mouse #events because the #DOM sucks, as of 2002, by #ppk. Unfortunately he’s trying to figure out where you clicked on the page, not where you clicked on the canvas, which is what I usually want to know.
on 02015-08-15An #STL #3D viewer library in #JS called stljs, originally from Cubehero. Also talks about using #POVRay and converting STL files to something it can read.
on 02015-08-10Facebook’s #reactive #JS library Flux is a complement to their React.
on 02015-08-05#imgui #dhtml #js #reactive discussion of “Pure UI”
on 02015-08-05“Pure UI” #imgui #dhtml #js #reactive wtf is an Artboard?
on 02015-08-05#JS strict mode throws an exception if you reference an undeclared variable (among other thigns)
on 02015-08-05Tarelli reports problems with PierreC’s #JS #LZ4 #compression implementation in #Chrome and #Firefox
on 02015-08-05Pierre Curto (github.com/pierrec) implemented #LZ4 in pure #JS but it takes 6.5 seconds to lz4-compress 110 megabytes of XML in #nodejs
on 02015-08-05