Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Callbags
Search
Stephan Schneider
May 15, 2018
Programming
0
73
Callbags
Introduction to the "callbags" specification for lightweight observables & iterables.
Stephan Schneider
May 15, 2018
Tweet
Share
More Decks by Stephan Schneider
See All by Stephan Schneider
Dynamic Schema Generation for Changing Data Models
zcei
0
140
Observables - Streams on steroids
zcei
0
170
Other Decks in Programming
See All in Programming
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
CSC307 Lecture 02
javiergs
PRO
1
770
Oxlint JS plugins
kazupon
1
740
CSC307 Lecture 06
javiergs
PRO
0
680
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
CSC307 Lecture 04
javiergs
PRO
0
660
Package Management Learnings from Homebrew
mikemcquaid
0
210
ThorVG Viewer In VS Code
nors
0
760
Architectural Extensions
denyspoltorak
0
270
組織で育むオブザーバビリティ
ryota_hnk
0
170
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
AI & Enginnering
codelynx
0
110
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Documentation Writing (for coders)
carmenintech
77
5.2k
The Pragmatic Product Professional
lauravandoore
37
7.1k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
310
Why Our Code Smells
bkeepers
PRO
340
58k
Designing for humans not robots
tammielis
254
26k
Odyssey Design
rkendrick25
PRO
1
490
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.9k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
210
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.6k
Transcript
Callbags BY STEPHAN SCHNEIDER
“Didn’t you mean ‘callbacks’” Literally everyone I told about this
talk
What are callbags? • a contract how callbacks work in
their context • similar to Node's error-first convention // error-first fs.readFile('/path/to/file', (err, data) => { ... }) // callbag source(0, (type, data) => { ... })
Generality Promise Observable Callbag Function Where does it stand?
Predictability Promise Observable Callbag Function Where does it stand?
The specification https://github.com/callbag/callbag
Sources - produces data Terms → Sinks - consumes data
→ Operators - takes a source, returns a source →
(type: number, payload?: any) => void
“End” - terminate the callbag “Start” - sent & received
once as part of the handshake Design Principles 0 2 Type 1 “Data” - deliver data to the callbag
• Call source with type === 0 • Callback is
greeted back with type === 0 • “Talkback” allows sending data to source Handshake
• type === 2 • Without second parameter: success •
Anything truthy as second parameter: error Termination
• type === 1 • Only after handshake • Only
before termination Data Delivery
“A standard for JS callbacks that enables lightweight observables and
iterables”
Let’s have a look at the code
• No central implementation • Anything that sticks to the
interface is considered a callback • There’s no official standard lib • Everyone is invited to become an operator maintainer Governance
Further reading • Spec: https://github.com/callbag/callbag • Comparison to RxJS: https://egghead.io/articles/comparing-callba
gs-to-rxjs-for-reactive-programming
Further reading • Wiki: https://github.com/callbag/callbag/wiki (contains a list of available
utility packages) • Toolkit of commonly used operators: https://github.com/staltz/callbag-basics