Recent articles (page 1 of 37)
-
Mar 23, 2023
Subspace Radio #24: Swearing in Star Trek
In Subspace Radio #24, Rob and I are both dazzled by what may be the best episode of modern Star Trek, “No Win Scenario”, and shocked by the return of 21st century expletives to the Star Trek universe. After gushing over every other aspect of this week’s episode, they share their very personal perspectives and reactions to swearing in Star Trek, and reflect on its history. Highlights of the trip include “Star Trek IV: The Voyage Home”, “City on the Edge of Forever” (TOS), “The Last Outpost” and “Elementary, Dear Data” (TNG), and “Star Trek: Generations”.
-
Mar 17, 2023
Subspace Radio #23: Best Worf Moments
In Subspace Radio #23, Rob and I agree that “Seventeen Seconds” was an episode written specifically for Rob, thanks to its loving embrace of Deep Space Nine as a core contributor to Star Trek history. Speaking of history, we take the opportunity of Worf’s return to our screens to reflect on the journey of everyone’s favourite son of Mogh. We touch on Redemption (TNG), Looking for par’Mach in All the Wrong Places (DS9), Parallels (TNG), and Tacking Into the Wind (DS9).
-
Mar 8, 2023
MelbJS March 2023 notes
Raw notes from the MelbJS meetup held at Culture Amp in Richmond on 8 March, 2023.
Fundamentals of Module Federation, Mathew Byrne
Permalink to Fundamentals of Module Federation, Mathew Byrne- Scaling build times
- Dependency versioning: Team A wants to upgrade React, Team B isn’t ready
- Deployments: slow builds means deploys back up
- In general, bottlenecks!
- Compromised user experience
- Hard to maintain client state across apps
- Scaling challenges still exist within each app
- Duplicate dependencies
- No on-demand loading of code. All dependencies must be available first.
- Manual juggling of those dependencies.
- Inflexible
- Performance: round-tripping of cascading requests for dependencies.
- Limited client support.
- Can’t use non-ESM dependencies.
- Host: The first webpack runtime to boot on the client
- Remote: A bundle that the host can dynamically load in when requested.
- These are not mutually exclusive.
ModuleFederationPlugin
that declares a remote forApp2
. App2’s webpack config has aModuleFederationPlugin
that declares that App2 is remote that can be loaded by a host. When App1 loads App2, App2 gets its react, etc. from App1. A bundle can be both a host and a remote, which enables some interesting configurations. The module federation project repo has dozens of examples. E.g. Bidirectional, two modules that can each act as a host, but load the other on demand. App Shell, a single host designed to load multiple remotes. MF first shipped with Webpack 5 in Oct 2020. Next 13, SSR support are now there. Delegate modules, a new feature like middleware for loading remotes (e.g. dynamic host selection, etc.), just landed. Further reading:- https://module-federation.github.io
- Follow Zack Jackson, @ScriptedAlchemy.
Standard Promises. Promise Standards, Franky
Permalink to Standard Promises. Promise Standards, Franky
How it works (according to the spec):const resolution = 'MelbJS!'; new Promise(function executor(resolve, reject) { const resolveIt = true; if (resolveIt) { resolve(resolution); } else { reject('Ew. JavaScript!'); } }) .then(function onFulfilled(result) { console.log(result); });
- Check that the
Promise
constructor was passed a function as an executor. - Create an internal promise object, using the Promise prototype, which includes all the promise features we’re used to (
then
, etc.). Creates some internal “slots” for information about the promise. - Create the
resolve
andreject
functions, which are passed into the executor later. - Call the executor function. If it completes successfully, it’s a normal completion. If it throws and exception, it’s an abrupt completion.
- Return the promise!
resolve
/reject
) work internally: Depending which is called, the promise will be fulfilled or rejected. Ifresolve
is called with another promise, that promise is used in turn to continue resolving. Otherwise, the promise is resolved straight away. How a promise is fulfilled:- [[PromiseState]]:
fulfilled
- [[PromiseValue]]:
'MelbJS!'
- [[PromiseIsHandled]]:
false
- [[PromiseFulfillReactions]]:
undefined
- [[PromiseRejectReactions]]:
undefined
then
method. The specification for this function is really, really long! For brevity, we’ll ignore all the parts that have to do with rejecting. This is where the HTML spec starts to come in. Thethen
method creates another promise, which operates just like the one we’ve been talking about. It’s a bit hidden, but it’s what lets us chain promises.then
takes a callback, which gets passed toHostMakeJobCallback
, and eventually is transformed into a fulfillReaction. Gets enqueued as a promise reaction job, which is sent to the browser engine – which takes it out of the JavaScript single-threaded execution environment! Its execution is controlled by the browser engine, not JavaScript itself. The Event loop processing model:- Event loop
- Task queue
- Microtask queue
- JavaScript runtime engine (heap and call stack)
HostEnqueuePromiseJob
schedules tasks on the high-priority microtask queue (defined in the HTML spec). Another example of how these two standards operate together:HostCallJobCallback
. Not covered for time (but equally interesting!): stuff like what happens ifresolve
is passed another promise. Opens up another can of worms. Also interesting, how browser APIs likefetch
work under the surface.Pyodide and JS: The One Language to Rule Them All, Hon Weng Chong
Permalink to Pyodide and JS: The One Language to Rule Them All, Hon Weng ChongtoJS
method to convert the return value of the Python program to JavaScript. Can also usepyodide.registerJsModule
to pass a JavaScript value into the Python runtime before running the Python program. Demo: a game of Pong implemented in Python, rendering its current state to a Canvas with JS. Pyodide is important because it will bring all of the machine learning and AI technologies (implemented in Python) into the Web, where we can give them a UI. -
Mar 7, 2023
Subspace Radio #22: Scenery-chewing Villains
In Subspace Radio #22, Rob and I are only momentarily distracted by the parentage of one Jack Crusher before latching onto Amanda Plummer’s performance as Vadic in Star Trek: Picard season three, episode two, “Disengage”. We then count down our favourite scenery-chewing villains from Star Trek canon, including Weyoun (DS9), General Chang (ST6), Khan (ST2), and Evil Kirk (TOS: The Enemy Within).
-
Mar 3, 2023
New Mac Day One Installs
I just picked up a new MacBook Pro 14" for personal use. Here's what I've installed on my first day with it. In other words, these are my "essential items" for a comfortable macOS environment.