Challenge: Solution Review
Explore how to implement the Model-View-Presenter (MVP) pattern by building an email sending system. Understand how the model stores data, the view handles user input, and the presenter coordinates between the two to update and display email information effectively.
We'll cover the following...
We'll cover the following...
Solution #
Explanation
The challenge requires you to use the MVP pattern to implement an email sending system. Hence, it has three components, the model, the view, and the presenter. Let’s discuss them one by one.
Model
class Model{
constructor(){
this.senderName = "";
this.receiverName = "";
this.emailTitle = "";
}
setSenderName(senderName){
this.senderName = senderName;
}
getSenderName(){
return this.senderName;
}
setReceiverName(receiverName){
this.receiverName = receiverName;
}
getReceiverName(){
return this.receiverName;
}
setEmailTitle(emailTitle){
this.emailTitle = emailTitle;
}
getEmailTitle(){
return this.emailTitle;
}
}
...