Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bigfanjs/mvpjsapp
Manually implementing MVP design pattern in JavaScript.
https://github.com/bigfanjs/mvpjsapp
Last synced: 4 days ago
JSON representation
Manually implementing MVP design pattern in JavaScript.
- Host: GitHub
- URL: https://github.com/bigfanjs/mvpjsapp
- Owner: bigfanjs
- Created: 2016-08-08T00:47:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-08T00:56:04.000Z (over 8 years ago)
- Last Synced: 2024-11-05T20:16:38.434Z (about 2 months ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Manually implementing MVP design pattern in JavaScript.
In this repository I've built a web application on top of an application-level structure using the MVP design pattern.
Here is the communication flow I used in my application:
![Alt text](/client/images/mvp.png?raw=true "MVP")## Advantages:
- your code would be more modulare.
- it's less painfull to debug.
- it's more testable(very easy to mock the view).
- the view is much more decoupled than the presenter.## Usage
const
model = Model.setup({
author: 'Adel',
title: 'Adel\'s blog',
url: 'http://adelsblogs.com'
}),
presenter = Presenter.setup({ model });### Testing The View.
const
mock = {
set() { return ''; },
get() { return ''; }
},
presenter = Presenter.setup({
view: mock
});