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
72
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
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
280
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.4k
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
22
6k
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
200
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
610
Introducing FrankenPHP gRPC
dunglas
1
550
1から理解するWeb Push
dora1998
7
2k
検索機能リプレイスを4ヶ月→2ヶ月に! AI Agentで実現した2倍速リプレイス
fuuki12
2
390
Design Foundational Data Engineering Observability
sucitw
3
210
半自動E2Eで手っ取り早くリグレッションテストを効率化しよう
beryu
3
480
メモリ不足との戦い〜大量データを扱うアプリでの実践例〜
kwzr
1
150
概念モデル→論理モデルで気をつけていること
sunnyone
3
310
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Building Adaptive Systems
keathley
43
2.7k
We Have a Design System, Now What?
morganepeng
53
7.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
GitHub's CSS Performance
jonrohan
1032
460k
A designer walks into a library…
pauljervisheath
207
24k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
Thoughts on Productivity
jonyablonski
70
4.8k
Building an army of robots
kneath
306
46k
Large-scale JavaScript Application Architecture
addyosmani
513
110k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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