Last active
June 3, 2020 15:43
-
-
Save richartkeil/c590e519ba2efac148a0a68b2cb7ac5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailBroadcaster { | |
broadcast(event: {}, user: SubscribedUser) { | |
// Send email with subscription information | |
// and event details to user. | |
} | |
} | |
class AnonymousEmailBroadcaster extends EmailBroadcaster { | |
broadcast(event: {}, user: User) { | |
// Send email with only event details to user. | |
} | |
} | |
function onAccountCreated(event: {}) { | |
const user = getCurrentSubscribedUser(); // returns type SubscribedUser | |
(new EmailBroadcaster).broadcast(event, user); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment