Skip to content

Client Structure

zoizer edited this page Mar 11, 2018 · 2 revisions

serverService.js
(Model)

Purpose

This js file is the server interface, used for calling the server.

Details

The serverService routes the specific function calls to the correct server address and using the correct server method, see Protocol for specifics. IF these server requests succeed then they automatically call the callback and log the success, if they fail they just log the failiure and do nothing.

accountView.js, commentView.js, groupView.js, postView.js
(View)

Purpose

These js files handle the display of data received from the server and the instantiation of mustache templates.

Details

The view files are registered as listeners to the eventBus, these then receive events which are interpreted and appropriatley displayed or stored for the client.

accountCtrl.js, commentCtrl.js, groupCtrl.js, postCtrl.js
(Control)

Purpose

These js files handle the user input and other requests which is parsed to the appropriate events or server requests.

Details

The typical functions included in these files obtain most of their option parameters from the plugin store.js and JQuery, occasionally the options are also obtained from function parameters. These are then used to decorate the nulled JSON object (see the Protocol for specifics) which will be sent to the server, these server calls are given an event containing the received data which will be sent to the eventBus if they succeed.

eventBus.js
(Util)

Purpose

Handles listeners routes events to them.

Details

While the eventBus is very simplistic and does not route events to specific listeners nor is it asynchronic like a typical event bus, it does allow for some level of separation between different parts of the program.

Clone this wiki locally