Home Reference Source
public class | source

AnswerQueue

An AnswerQueue stamp messages with unique ids and allow peers to answer to service calls using the reply and reject helpers.

Constructor Summary

Public Constructor
public

Constructor

Member Summary

Private Members
private

Method Summary

Public Methods
public

reject(answerID: string, payload: *): void

Resolve an answer by a reject

public

resolve(answerID: string, payload: *): void

Resolve the answer to a message

public

stamp(message: Object, resolve: function, reject: function): Object

Stamp a message and connect to a promise resolved with it answer

Public Constructors

public constructor() source

Constructor

Private Members

private _waitingAnswers: * source

Public Methods

public reject(answerID: string, payload: *): void source

Resolve an answer by a reject

Params:

NameTypeAttributeDescription
answerID string

The id of the answer to reject

payload *

The answer's content

Return:

void

public resolve(answerID: string, payload: *): void source

Resolve the answer to a message

Params:

NameTypeAttributeDescription
answerID string

The id of the answer to resolve

payload *

The answer's content

Return:

void

public stamp(message: Object, resolve: function, reject: function): Object source

Stamp a message and connect to a promise resolved with it answer

Params:

NameTypeAttributeDescription
message Object

The message to stamp

resolve function

The function used to resolve the promise when the answer is received

reject function

The function used to reject the promise when the answer is received

Return:

Object

The stamped message