Class: WatchList

WatchList(params)

new WatchList(params)

An extension of the WatchstarPageList which preloads pages as all being watched.

Parameters:
Name Type Description
params Object

Configuration options

Properties
Name Type Description
eventBus OO.EventEmitter

Object used to listen for scroll:throttled events

Source:
Fires:
  • event:watched
  • event:watch

Extends

Members

defaults

Properties:
Name Type Description
defaults Object

Default options hash.

Properties
Name Type Description
pages Array.<Page>

Array of Page objects. These should match the Page model and not necessarily the underlying API format used. E.g. [ { heading: "Claude Monet", id: undefined, title: "Claude Monet", displayTitle: "Claude Monet", url: "/wiki/Claude_Monet", thumbnail: { height: 62, source: "http://127.0.0.1:8080/images/thumb/thumb.jpg", width: 80, isLandscape: true } } ]

Inherited From:
Mixes In:
Source:

isTemplateMode

Tells the View to ignore tagName and className when constructing the element and to rely solely on the template

Properties:
Name Type Description
isTemplateMode boolean
Inherited From:
Source:

tagName

Name of tag that contains the rendered template

Properties:
Name Type Description
tagName string
Inherited From:
Source:

template

Properties:
Name Type Description
Specifies Mixed

the template used in render(). Object|string

Inherited From:
Source:

templatePartials

Inherited From:
Source:

Methods

_loadPages()

Loads pages from the api and triggers render. Infinite scroll is re-enabled in postRender.

Source:

after(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | jQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

append(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | jQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

appendPage(page)

Appends a list item

Parameters:
Name Type Description
page Page
Source:

appendTo(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | jQuery
Inherited From:
Source:
Returns:
Type
this

before(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | jQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

delegate(eventName, selector, listener)

Add a single event listener to the view's element (or a child element using selector). This only works for delegate-able events: not focus or blur.

Parameters:
Name Type Description
eventName string
selector string
listener function
Inherited From:
Source:

delegateEvents(events)

Set callbacks, where this.options.events is a hash of

{ 'event selector': 'callback' }

{ 'mousedown .title': 'edit', 'click .button': 'save', 'click .open': function(e) { ... } }

pairs. Callbacks will be bound to the view, with this set properly. Uses event delegation for efficiency. Omitting the selector binds the event to this.el.

Parameters:
Name Type Description
events Object

Optionally set this events instead of the ones on this.

Inherited From:
Source:

detach(selectoropt) → {this}

Parameters:
Name Type Attributes Description
selector string <optional>
Inherited From:
Source:
Returns:
Type
this

getLastTitle($el) → {string}

Get the last title from the rendered HTML. Used for initializing the API

Parameters:
Name Type Description
$el jQuery.Object

Dom element of the list

Source:
Returns:
Type
string

getPages(ids, titles) → {jQuery.Deferred.<WatchStatusMap>}

Retrieve pages

Parameters:
Name Type Description
ids Array.<PageID>
titles Array.<PageTitle>
Inherited From:
Source:
Returns:
Type
jQuery.Deferred.<WatchStatusMap>

hide()

Hides panel

Inherited From:
Source:

initialize(options)

Run once during construction to set up the View

Parameters:
Name Type Description
options Object

Object passed to the constructor.

Properties
Name Type Attributes Description
events Object.<string, string> <optional>
Inherited From:
Source:

insertAfter(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | jQuery
Inherited From:
Source:
Returns:
Type
this

insertBefore(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | jQuery
Inherited From:
Source:
Returns:
Type
this

parseHTML(html) → {jQuery.Object}

See parseHTML method of util singleton

Parameters:
Name Type Description
html string

to turn into a jQuery object.

Inherited From:
Source:
Returns:
Type
jQuery.Object

parsePagesFromItems($items) → {PageTitleToPageIDMap}

Parameters:
Name Type Description
$items jQuery.Element
Inherited From:
Source:
Returns:
Type
PageTitleToPageIDMap

postRender()

Properties:
Name Type Description
defaults Object

Default options hash.

Properties
Name Type Description
api mw.Api
Overrides:
Mixes In:
Source:

prepend(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | jQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

prependTo(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | jQuery
Inherited From:
Source:
Returns:
Type
this

preRender()

Function called before the view is rendered. Can be redefined in objects that extend View.

Overrides:
Source:

remove(selectoropt) → {this}

Parameters:
Name Type Attributes Description
selector string <optional>
Inherited From:
Source:
Returns:
Type
this

render(data)

Fill this.$el with template rendered using data if template is set.

Parameters:
Name Type Description
data Object

Template data. Will be merged into the view's options

Inherited From:
Source:

renderPageImages()

Render page images for the existing page list. Assumes no page images have been loaded.

Inherited From:
Source:

show() → {jQuery.Promise}

Shows panel after a slight delay

Inherited From:
Source:
Returns:
Type
jQuery.Promise

undelegate(eventName, selector, listener)

A finer-grained undelegateEvents for removing a single delegated event. selector and listener are both optional.

Parameters:
Name Type Description
eventName string
selector string
listener function
Inherited From:
Source:

undelegateEvents()

Clears all callbacks previously bound to the view by delegateEvents. You usually don't need to use this, but may wish to if you have multiple views attached to the same DOM element.

Inherited From:
Source: