--- layout: docs title: DraftStore edit_url: "https://github.com/nylas/N1/blob/master/src/flux/stores/draft-store.coffee" ---

Summary

DraftStore responds to Actions that interact with Drafts and exposes public getter methods to return Draft objects and sessions.

It also creates and queues Task objects to persist changes to the Nylas API.

Remember that a "Draft" is actually just a "Message" with draft: true.

Instance Methods

sessionForClientId(clientId)

Fetch a DraftStoreProxy for displaying and/or editing the draft with clientId.

Example:

session = DraftStore.sessionForClientId(clientId)
    session.prepare().then ->
       # session.draft() is now ready
    

Parameters
Argument Description
clientId

The String clientId of the draft.

Returns
Return Values

Returns a Promise that resolves to an DraftStoreProxy for the draft once it has been prepared:

isSendingDraft()

Look up the sending state of the given draftClientId. In popout windows the existance of the window is the sending state.

extensions()

Returns
Return Values

Returns the extensions registered with the DraftStore.

registerExtension(ext)

Registers a new extension with the DraftStore. DraftStore extensions make it possible to extend the editor experience, modify draft contents, display warnings before draft are sent, and more.

Parameters
Argument Description
ext

A DraftStoreExtension instance.

unregisterExtension(ext)

Unregisters the extension provided from the DraftStore.

Parameters
Argument Description
ext

A DraftStoreExtension instance.