Reference Source
public class | source

HomePresenter

Extends:

* → HomePresenter

Class for the Home presenter and view

Constructor Summary

Public Constructor
public

Creates an instance of HomePresenter

Member Summary

Public Members
public

Forces a refresh for the view by recalcuating the timeago property, resorting bookmarked data and setting the state again.

public

Returns the bookmarked state for a bike ID

public

Gets the data from the model and returns it to the caller.

public

Get the number of notifications from the Alerts model.

public

getProfileImage(callback: Function): *

Get the profile picture from the profile model

public

Handle the search cancel.

public

Handle the search clear

public

Filter the items in the list based on the text passed in.

public

If the view or presenter is destroyed, unsubscribe the presenter from the model.

public

onUpdated(newData: Object): *

Called when the model is updated with new data.

public

Sets the bookmark for the notification ID

public

update(newData: Object): *

Updates the bike model with new data.

public

view: *

Method Summary

Private Methods
private

Public Constructors

public constructor(view: Object) source

Creates an instance of HomePresenter

Params:

NameTypeAttributeDescription
view Object

An instance of a view class

Public Members

public forceRefresh: * source

Forces a refresh for the view by recalcuating the timeago property, resorting bookmarked data and setting the state again.

public getBookmarked(id: Number): Boolean: * source

Returns the bookmarked state for a bike ID

Return:

Boolean

true: if ID is bookmarked by user; false: otherwise

public getData: Object: * source

Gets the data from the model and returns it to the caller.

Return:

Object

Data from the model.

public getNotificationCount: Number: * source

Get the number of notifications from the Alerts model.

Return:

Number

The number of notifications

public getProfileImage(callback: Function): * source

Get the profile picture from the profile model

public handleSearchCancel: * source

Handle the search cancel.

public handleSearchClear: * source

Handle the search clear

public handleSearchFilter(text: string): * source

Filter the items in the list based on the text passed in. Called every time a letter is typed.

public onDestroy: * source

If the view or presenter is destroyed, unsubscribe the presenter from the model.

public onUpdated(newData: Object): * source

Called when the model is updated with new data. Refreshes the state of the view. Method is supplied with the data to add. Better way to refresh the state?

public setBookmark(id: Number): * source

Sets the bookmark for the notification ID

public update(newData: Object): * source

Updates the bike model with new data.

public view: * source

Private Methods

private testUpdateInjection(data: *) source

Params:

NameTypeAttributeDescription
data *