
New post - 'An intro to agile for new devs'
The core of my skillset is front end, including expertise in React, page load performance, accessibility and authoring UI component libraries. I also have 8 years’ solid experience of Node.js.
I understand every angle of a successful agile team including user-centred research and design, continuous delivery, TDD, test automation & strategy, pairing and shared ownership of quality and dev-ops.
React
scalable CSS including CSS-in-JS
Node.js
Javascript
Typescript
page performance
accessibility
micro-services
micro-frontends
progressive enhancement
TDD & unit tests
BDD & end-to-end tests
responsive / mobile web
CI / CD
agile
rapid prototyping
A Javascript event hub using promises
The event hub / aggregator pattern is fantastic for decoupling code modules but the emitted events are usually ‘fire and forget’ so if the event listeners want to feed back an error or status report to the event emitter, they can’t.
Adding promises solves this – if the event is published then each event listener will receive its own promise. Once the listener has performed any synchronous / async tasks that it needs to, it can choose to resolve or reject the promise it has received. If all event listeners report success using their promises, then a promise passed back to the emitter will resolve successfully. However if one or more of the listeners reject (fail) their promises, it will fail.
Because the event listeners are receiving promises, they can wait until async activities eg. ajax are complete before resolving their promise. Handy if decoupled modules need to save state or complete animations before feeding back to the event emitter.
The code is on Github, hope it helps someone!