why deepstreamHub? compare us getting started faq
use cases
products
developers
company
blog contact

A List is a specialised Record that contains an Array of recordNames and provides a number of convinience methods for interacting with them.

Methods

isReady()

class func isReady() -> Bool

True if the list's initial data-set has been loaded from deepstream

isDestroyed()

class func isDestroyed() -> Bool

Return whether the list has been destroyed. If true it needs to be recreated via RecordHandler.getList(_:)

version()

class func version() -> Int

Return the list version. This is solely used within a RecordMergeStrategy

name()

class func name() -> String

Return the list name

addRecordEventsListener(_:)

addRecordEventsListener(_ listener: RecordEventsListener) -> Self
argument type description
listener RecordEventsListener The listener to add

Adds a Listener that will be invoked whenever a discard, delete or error event occurs

removeRecordEventsListener(_:)

class func removeRecordEventsListener(_ listener: RecordEventsListener) -> Self
argument type description
listener RecordEventsListener The listener to remove

Removes a Listener that was added via List#removeRecordEventsListener

getEntries()

class func getEntries() -> Array<String>

Returns the array of list entries or an empty array if the list hasn't been populated yet.

setEntries(_:)

class func setEntries(_ entries: Array<String>) -> Self
argument type description
entries List The recordNames to update the list with

Updates the list with a new set of entries

removeEntry(_:)

class func removeEntry(entry: String) -> Self
argument type description
entry String The entry to remove from the list

Removes the first occurrence of an entry from the list

removeEntry(_:index:)

class func removeEntry(_ entry: String, index: int) -> Self
argument type description
entry String The entry to remove from the list
index Int The index at which the entry should reside at

Removes an entry from the list if it resides at a specific index

addEntry(_:)

class func addEntry(_ entry: String) -> Self
argument type description
entry String The entry to add to the list

Add an entry to the end of the list

addEntry(_:index:)

class func addEntry(_ entry: String, index: Int) -> Self
argument type description
entry String The entry to add from the list
index Int The index at which the entry should reside at

Adds an entry to the list at a specific index

isEmpty()

boolean isEmpty()

Returns true if the list is empty

subscribe(_:)

class func subscribe(_ listener: ListChangedListener) -> Self
argument type description
listener ListChangedListener The listener to add

Notifies the user whenever the list has changed

subscribe(_:triggerNow:)

class func subscribe(_ listener: ListChangedListener, triggerNow: Bool) -> Self
argument type description
listener ListChangedListener The listener to add
triggerNow boolean Whether to trigger the listener immediately

Notifies the user whenever the list has changed, and notifies immediately if triggerNow is true

subscribe(_:)

class func unsubscribe(_ listener: ListChangedListener) -> Self
argument type description
listener ListChangedListener The listener to remove

Removes the listener added via subscribe(listener, triggerNow)

subscribe(_:)

class func subscribe(_ listener: ListEntryChangedListener) -> Self
argument type description
listener ListEntryChangeListener The listener to add

Add a listener to notify the user whenever an entry is added, removed or moved within the list

unsubscribe(_:)

class func unsubscribe(_ listener: ListEntryChangedListener) -> Self
argument type description
listener ListEntryChangeListener The listener to remove

Remove the listener added via subscribe(listEntryChangeListener)