Attaching new behaviors through decorators in JavaScript #230
VarvaraSandakova
started this conversation in
Article discussion
Replies: 1 comment 1 reply
-
Hi, good article! In this snippet you are missing some keywords. function functionBasedNotificationFactory() {
type: 'Success',
notifyUser() {
console.log(`${type} notification`);
}
return {
name: 'Success',
notifyUser: delayMiliseconds(notifyUser, 300);
}
} function functionBasedNotificationFactory() {
const type = 'Success'
function notifyUser() {
console.log(`${type} notification`);
}
return {
name: 'Success',
notifyUser: delayMiliseconds(notifyUser, 300)
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's take a look under the hood of the decorator's implementation in JavaScript. We'll learn how to change behavior through decorators in JavaScript using functional or class-based approaches.
Read the article here.
Beta Was this translation helpful? Give feedback.
All reactions