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
Code Reuse in Node.js (the short version)
Search
Makara Wang
April 20, 2013
Programming
0
74
Code Reuse in Node.js (the short version)
Makara Wang
April 20, 2013
Tweet
Share
More Decks by Makara Wang
See All by Makara Wang
Loose Coupling with Message Queue / Bus (the short version)
makara
1
89
Asynchronous JS with Promise (+ Workshop)
makara
0
77
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
初めてDefinitelyTypedにPRを出した話
syumai
0
270
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
220
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
420
Tuning GraphQL on Rails
pyama86
2
1.2k
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.7k
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
420
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
470
Java ジェネリクス入門 2024
nagise
0
700
Jakarta EE meets AI
ivargrimstad
0
290
Contemporary Test Cases
maaretp
0
120
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
320
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
What's new in Ruby 2.0
geeforr
343
31k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Docker and Python
trallard
40
3.1k
Happy Clients
brianwarren
98
6.7k
RailsConf 2023
tenderlove
29
900
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Cult of Friendly URLs
andyhume
78
6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.8k
Optimizing for Happiness
mojombo
376
70k
Transcript
Code Reuse in Node.js (the short version) ⺩王浩宇 Makara Wang
[email protected]
2013.04.20
Assuming you know... JS & Node.js Prototype “this”
Common ways... Function + Arguments Good for: everything, promise, ...
Common ways... Prototype + Class Good for: modeling... ...or you
really care about performance ...or you want the long prototype chain
Common ways... Function Copy this[key] = that[key]; Good for: simpler
syntax, better syntax, ...
My favorite Function Copy ...with “Object.defineProperties()” Because it’s Node.js (not
a broken browser)
Implementations https://github.com/medikoo/es5-ext require('es5-ext/lib/Object/extend-properties'); https://github.com/devo-ps/carcass carcass.mixable(obj);
(Personal) Notes Use “this” Return “this” Reduce arguments Avoid “bind()”
...
Thanks!