Class SpazTimeline

Defined in: spaztimeline.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
SpazTimeline(opts)

This object provides an API for managing the content of a timeline Currently this requires jQuery, but that could change or be overwritten on a per-app basis

Field Summary
Field Attributes Field Name and Description
 

the timeline

 

an array of data items that are represented in the timeline

Method Summary
Method Attributes Method Name and Description
 
addItems(items)

given an array of objects, this will render them and add them to the timeline

 
append(htmlitem)

 

Stuff we should do when we're done using this, including removing event listeners an stopping the refresher

 
filterItems(selector, type)

 

 
hideItems(selector)

 
itemExists(selector)

 
onFailure(e, data)

Again, due to scope issues, we define this here to take advantage of the closure

 
onSuccess(e, data)

Again, due to scope issues, we define this here to take advantage of the closure

 
prepend(htmlitem)

wrapper for prepending to timeline

 

This is a wrapper function for the refresher interval we define this here and use a closure to solve a scope issue when the interval fires

 

 
removeItem(selector)

 
removeItems(selector)

 
renderItem(item, templatefunc)

 

This is the method that gets data from the model and calls addItems() on what is returned

 
select(selector, container)

This is a wrapper for the selector engine, so someone could swap in their own recipe if necessary.

 
showItems(selector)

 
sortItems(selector, sortfunc)

sorts the elements in the timeline according to the sorting function

 

call this after initialization

 

 

 

 

Class Detail

SpazTimeline(opts)

This object provides an API for managing the content of a timeline Currently this requires jQuery, but that could change or be overwritten on a per-app basis

Parameters:
opts
Requires:
jQuery
Field Detail

last_id

the timeline

model

an array of data items that are represented in the timeline

Method Detail

addItems(items)

given an array of objects, this will render them and add them to the timeline

Parameters:
{array} items

append(htmlitem)

Parameters:
htmlitem

cleanup()

Stuff we should do when we're done using this, including removing event listeners an stopping the refresher

filterItems(selector, type)

Parameters:
{string} selector
{string} type
"whitelist" or "blacklist"

getEntrySelector()

hideItems(selector)

Parameters:
selector

{boolean} itemExists(selector)

Parameters:
{string} selector
Returns:
{boolean}

onFailure(e, data)

Again, due to scope issues, we define this here to take advantage of the closure

Parameters:
e
data

onSuccess(e, data)

Again, due to scope issues, we define this here to take advantage of the closure

Parameters:
e
data

prepend(htmlitem)

wrapper for prepending to timeline

Parameters:
htmlitem

refresh()

This is a wrapper function for the refresher interval we define this here and use a closure to solve a scope issue when the interval fires

removeExtraItems()

removeItem(selector)

Parameters:
selector

removeItems(selector)

Parameters:
selector

renderItem(item, templatefunc)

Parameters:
item
templatefunc

requestData()

This is the method that gets data from the model and calls addItems() on what is returned

{DOMelement[]} select(selector, container)

This is a wrapper for the selector engine, so someone could swap in their own recipe if necessary. By default we use jQuery, and return the array of HTML elements (not the jQuery object)

Parameters:
selector
container

showItems(selector)

Parameters:
selector

sortItems(selector, sortfunc)

sorts the elements in the timeline according to the sorting function

Parameters:
selector
sortfunc

start()

call this after initialization

startListening()

startRefresher()

stopListening()

stopRefresher()