ContactStore extends NylasStore

Summary

ContactStore maintains an in-memory cache of the user's address book, making it easy to build autocompletion functionality and resolve the names associated with email addresses.

Listening for Changes

The ContactStore monitors the DatabaseStore for changes to Contact models and triggers when contacts have changed, allowing your stores and components to refresh data based on the ContactStore.

@unsubscribe = ContactStore.listen(@_onContactsChanged, @)

_onContactsChanged: ->
  # refresh your contact results

Instance Methods

searchContacts(search[options])

Search the user's contact list for the given search term. This method compares the search string against each Contact's name and email.

Parameters
Argument Description
search

String A search phrase, such as ben@n or Ben G

options Optional

Object If you will only be displaying a few results, you should pass a limit value. searchContacts will return as soon as limit matches have been found.

Returns
Return Values

Returns an Array of matching Contact models

isValidContact()

Returns
Return Values

Returns true if the contact provided is a Contact instance and contains a properly formatted email address.