Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 21a9f43

Browse files
author
Eduardo Fullea
committed
Futures in MessagingManager
1 parent ca1a45a commit 21a9f43

File tree

1 file changed

+95
-110
lines changed

1 file changed

+95
-110
lines changed

index.html

Lines changed: 95 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ <h2><a>MessagingManager</a> Interface</h2>
156156
<dt>readonly attribute MmsManager mms</dt> <dd>Provides access to the
157157
MMS service's specific functionality.</dd>
158158

159-
<dt> MessagingRequest findMessages ()</dt> <dd>This method makes a request
159+
<dt> Future findMessages ()</dt> <dd>This method makes a request
160160
to retrieve the messages matching the filter described by the
161161
<code>filter</code> parameter and according to the filtering options
162162
described in the <code>options</code>. It returns a new
163-
<code>MessagingRequest</code> that will be used to notify the caller about
163+
<code>Future</code> that will be used to notify the caller about
164164
the result of the operation, which is a MessagingCursor to access the set of
165165
messages.
166166
<dl class='parameters'>
@@ -174,14 +174,14 @@ <h2><a>MessagingManager</a> Interface</h2>
174174
</dl>
175175
</dd>
176176

177-
<dt> MessagingRequest findConversations ()</dt> <dd>This method makes a
177+
<dt> Future findConversations ()</dt> <dd>This method makes a
178178
request to retrieve the list of conversations in which the messages can be
179179
grouped using the criteria defined by the <code>groupBy</code> parameter.
180180
Only those messages matching the filter described in the <code>filter</code>
181181
parameter SHALL be included in the resulting conversations, what can be
182182
useful for instance to filter just a specific type of messages (e.g. SMS) or
183183
to implement message search in a conversational messaging client. It returns
184-
a new <code>MessagingRequest</code> that will be used to notify the caller
184+
a new <code>Future</code> that will be used to notify the caller
185185
about the result of the operation, which is a MessagingCursor to access the
186186
set of conversations.
187187
<dl class='parameters'>
@@ -202,9 +202,9 @@ <h2><a>MessagingManager</a> Interface</h2>
202202
</dl>
203203
</dd>
204204

205-
<dt> MessagingRequest getMessage ()</dt> <dd>This method makes a request to
205+
<dt> Future getMessage ()</dt> <dd>This method makes a request to
206206
retrieve the message identified by the <code>messageID</code> parameter.
207-
It returns a new <code>MessagingRequest</code> object which allows the
207+
It returns a new <code>Future</code> object which allows the
208208
caller to be notified about the result of the operation.
209209
<dl class='parameters'>
210210
<dt>DOMString messageID</dt> <dd>
@@ -213,9 +213,9 @@ <h2><a>MessagingManager</a> Interface</h2>
213213
</dl>
214214
</dd>
215215

216-
<dt> MessagingRequest deleteMessage ()</dt> <dd>This method requests the
216+
<dt> Future deleteMessage ()</dt> <dd>This method requests the
217217
deletion of the message with identifier equal to the <code>messageID</code>
218-
parameter. A new <code>MessagingRequest</code> is returned in order to
218+
parameter. A new <code>Future</code> is returned in order to
219219
notify the request result (success or error) to the caller.
220220
<dl class='parameters'>
221221
<dt>DOMString messageID</dt> <dd>
@@ -224,9 +224,9 @@ <h2><a>MessagingManager</a> Interface</h2>
224224
</dl>
225225
</dd>
226226

227-
<dt> MessagingRequest deleteConversation ()</dt> <dd>This method requests
227+
<dt> Future deleteConversation ()</dt> <dd>This method requests
228228
the deletion of all the messages in the conversation with identifier equal
229-
to the <code>conversationID</code> parameter. A new <code>MessagingRequest</code> is
229+
to the <code>conversationID</code> parameter. A new <code>Future</code> is
230230
returned in order to notify the request result (success or error) to the
231231
caller.
232232
<dl class='parameters'>
@@ -237,10 +237,10 @@ <h2><a>MessagingManager</a> Interface</h2>
237237
</dl>
238238
</dd>
239239

240-
<dt> MessagingRequest markMessageRead ()</dt> <dd>This method requests to
240+
<dt> Future markMessageRead ()</dt> <dd>This method requests to
241241
mark as read or unread the message with identifier equal to the
242242
<code>messageID</code> parameter. The method returns a new
243-
<code>MessagingRequest</code> that will allow the caller to be notified
243+
<code>Future</code> that will allow the caller to be notified
244244
about the result (success, error) of the operation.
245245
<dl class='parameters'>
246246
<dt>DOMString messageID</dt> <dd>
@@ -253,10 +253,10 @@ <h2><a>MessagingManager</a> Interface</h2>
253253
</dl>
254254
</dd>
255255

256-
<dt> MessagingRequest markConversationRead ()</dt> <dd>This method
256+
<dt> Future markConversationRead ()</dt> <dd>This method
257257
requests to mark as read or unread all the messages in the conversation with
258258
identifier equal to the <code>conversationID</code> parameter. The method returns a new
259-
<code>MessagingRequest</code> that will allow the caller to be notified
259+
<code>Future</code> that will allow the caller to be notified
260260
about the result (success, error) of the operation.
261261
<dl class='parameters'>
262262
<dt>DOMString conversationID</dt> <dd>
@@ -279,22 +279,19 @@ <h3>Steps</h3>
279279
<li>Make a request to the system to get the message(s) matching the filter
280280
included in the <code>filter</code> parameter and according to the
281281
filtering options described in the <code>options</code> parameter.
282-
<li>Create a new <code>MessagingRequest</code> object and set
283-
<code>state</code> of the <code>MessagingRequest</code> object to
284-
'processing' and return the <code>MessagingRequest</code> to the caller.
285-
<li>If there is an error invoke the <code>onerror</code> <a>event
286-
handler</a> of the <code>MessagingRequest</code> object.
287-
<li>When the request has been completed:
282+
<li>Let <var>future</var> be a new <code>Future</code> object and
283+
<var>resolver</var> its associated <code>resolver</code>
284+
<li>Return <var>future</var> to the caller.
285+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
286+
<code>reject(value)</code>method with <var>error</var> as
287+
<code>value</code> argument.
288+
<li>When the request has been successfully completed:
288289
<ol>
289-
<li>Set the <code>readyState</code> of the <code>MessagingRequest</code>
290-
object to 'done'.
291-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
292-
object to a <code>MessagingCursor</code> providing access to the results
293-
of the retrieval, i.e. the set of <code>SmsMessage</code> and/or
294-
<code>MmsMessage</code> elements.
295-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
296-
href="#dfn-eventhandler">event handlers</a> of the
297-
<code>MessagingRequest</code>.
290+
<li>Let <var>messagingCursor</var> be a new <code>MessagingCursor</code>
291+
object providing access to the results of the retrieval, i.e. the set of
292+
<code>SmsMessage</code> and/or <code>MmsMessage</code> elements.
293+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
294+
<var>messagingCursor</var> as <code>value</code> argument.
298295
</ol>
299296
</ol>
300297

@@ -307,44 +304,40 @@ <h3>Steps</h3>
307304
the messages included in those conversations according to the filter
308305
included in the <code>filter</code> parameter and the filtering options
309306
described in the <code>options</code> parameter.
310-
<li>Create a new <code>MessagingRequest</code> object and set
311-
<code>readyState</code> of the <code>MessagingRequest</code> object to
312-
'processing' and return the <code>MessagingRequest</code> to the caller.
313-
<li>If there is an error invoke the <code>onerror</code> <a>event
314-
handler</a> of the <code>MessagingRequest</code> object.
315-
<li>When the request has been completed:
307+
<li>Let <var>future</var> be a new <code>Future</code> object and
308+
<var>resolver</var> its associated <code>resolver</code>
309+
<li>Return <var>future</var> to the caller.
310+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
311+
<code>reject(value)</code>method with <var>error</var> as
312+
<code>value</code> argument.
313+
<li>When the request has been successfully completed:
316314
<ol>
317-
<li>Set the <code>readyState</code> of the
318-
<code>MessagingRequest</code> object to 'done'.
319-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
320-
object to a <code>MessagingCursor</code> providing access to the results
321-
of the retrieval, i.e. the set of <code>Conversation</code> elements.
322-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
323-
href="#dfn-eventhandler">event handlers</a> of the
324-
<code>MessagingRequest</code>.
325-
</ol>
315+
<li>Let <var>messagingCursor</var> be a new <code>MessagingCursor</code>
316+
object providing access to the results of the retrieval, i.e. the set of
317+
<code>Conversation</code> elements.
318+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
319+
<var>messagingCursor</var> as <code>value</code> argument.
320+
</ol>
326321
</ol>
327322

328323
<p> The <dfn><code>getMessage</code></dfn> method when invoked MUST run
329324
the following steps:
330325
<ol>
331326
<li>Make a request to the system to get the message with identifier equal
332327
to the <code>messageID</code> parameter passed in the request.
333-
<li>Create a new <code>MessagingRequest</code> object and set
334-
<code>readyState</code> of the <code>MessagingRequest</code> object to
335-
'processing' and return the <code>MessagingRequest</code> to the caller.
336-
<li>If there is an error invoke the <code>onerror</code> <a>event
337-
handler</a> of the <code>MessagingRequest</code> object.
338-
<li>When the request has been completed:
328+
<li>Let <var>future</var> be a new <code>Future</code> object and
329+
<var>resolver</var> its associated <code>resolver</code>
330+
<li>Return <var>future</var> to the caller.
331+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
332+
<code>reject(value)</code>method with <var>error</var> as
333+
<code>value</code> argument.
334+
<li>When the request has been successfully completed:
339335
<ol>
340-
<li>Set the <code>readyState</code> of the
341-
<code>MessagingRequest</code> object to 'done'.
342-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
343-
object to the <code>SmsMessage</code> or <code>MmsMessage</code> whose
344-
identifier matches the <code>messageID</code> parameter.
345-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
346-
href="#dfn-eventhandler">event handlers</a> of the
347-
<code>MessagingRequest</code>.
336+
<li>Let <var>message</var> be the <code>SmsMessage</code> or
337+
<code>MmsMessage</code> whose identifier matches the
338+
<code>messageID</code> parameter.
339+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
340+
<var>message</var> as <code>value</code> argument.
348341
</ol>
349342
</ol>
350343

@@ -353,20 +346,18 @@ <h3>Steps</h3>
353346
<ol>
354347
<li>Make a request to the system to delete the message with identifier
355348
equal to the <code>messageID</code> parameter passed in the request.
356-
<li>Create a new <code>MessagingRequest</code> object and set
357-
<code>readyState</code> of the <code>MessagingRequest</code> object to
358-
'processing' and return the <code>MessagingRequest</code> to the caller.
359-
<li>If there is an error invoke the <code>onerror</code> <a>event
360-
handler</a> of the <code>MessagingRequest</code> object.
361-
<li>When the request has been completed:
349+
<li>Let <var>future</var> be a new <code>Future</code> object and
350+
<var>resolver</var> its associated <code>resolver</code>
351+
<li>Return <var>future</var> to the caller.
352+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
353+
<code>reject(value)</code>method with <var>error</var> as
354+
<code>value</code> argument.
355+
<li>When the request has been successfully completed:
362356
<ol>
363-
<li>Set the <code>readyState</code> of the
364-
<code>MessagingRequest</code> object to 'done'.
365-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
366-
object to 'true'.
367-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
368-
href="#dfn-eventhandler">event handlers</a> of the
369-
<code>MessagingRequest</code>.
357+
<li>Let <var>messageID</var> be the <code>messageID</code> parameter
358+
passed in the request
359+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
360+
<var>messageID</var> as <code>value</code> argument.
370361
</ol>
371362
</ol>
372363

@@ -376,20 +367,18 @@ <h3>Steps</h3>
376367
<li>Make a request to the system to delete the messages in the conversation
377368
with identifier equal to the <code>conversationID</code> parameter passed in the
378369
request.
379-
<li>Create a new <code>MessagingRequest</code> object and set
380-
<code>readyState</code> of the <code>MessagingRequest</code> object to
381-
'processing' and return the <code>MessagingRequest</code> to the caller.
382-
<li>If there is an error invoke the <code>onerror</code> <a>event
383-
handler</a> of the <code>MessagingRequest</code> object.
384-
<li>When the request has been completed:
370+
<li>Let <var>future</var> be a new <code>Future</code> object and
371+
<var>resolver</var> its associated <code>resolver</code>
372+
<li>Return <var>future</var> to the caller.
373+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
374+
<code>reject(value)</code>method with <var>error</var> as
375+
<code>value</code> argument.
376+
<li>When the request has been successfully completed:
385377
<ol>
386-
<li>Set the <code>readyState</code> of the
387-
<code>MessagingRequest</code> object to 'done'.
388-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
389-
object to 'true'.
390-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
391-
href="#dfn-eventhandler">event handlers</a> of the
392-
<code>MessagingRequest</code>.
378+
<li>Let <var>conversationID</var> be the <code>conversationID</code> parameter
379+
passed in the request
380+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
381+
<var>conversationID</var> as <code>value</code> argument.
393382
</ol>
394383
</ol>
395384

@@ -400,20 +389,18 @@ <h3>Steps</h3>
400389
<code>value</code> parameter being respectively 'true' or 'false') the
401390
message with identifier equal to the <code>messageID</code> parameter passed in
402391
the request.
403-
<li>Create a new <code>MessagingRequest</code> object and set
404-
<code>readyState</code> of the <code>MessagingRequest</code> object to
405-
'processing' and return the <code>MessagingRequest</code> to the caller
406-
<li>If there is an error invoke the <code>onerror</code> <a>event
407-
handler</a> of the <code>MessagingRequest</code> object
408-
<li>When the request has been completed:
392+
<li>Let <var>future</var> be a new <code>Future</code> object and
393+
<var>resolver</var> its associated <code>resolver</code>
394+
<li>Return <var>future</var> to the caller.
395+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
396+
<code>reject(value)</code>method with <var>error</var> as
397+
<code>value</code> argument.
398+
<li>When the request has been successfully completed:
409399
<ol>
410-
<li>Set the <code>readyState</code> of the <code>MessagingRequest</code>
411-
object to 'done'.
412-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
413-
object to 'true'.
414-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
415-
href="#dfn-eventhandler">event handlers</a> of the
416-
<code>MessagingRequest</code>.
400+
<li>Let <var>messageID</var> be the <code>messageID</code> parameter
401+
passed in the request
402+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
403+
<var>messageID</var> as <code>value</code> argument.
417404
</ol>
418405
</ol>
419406

@@ -424,20 +411,18 @@ <h3>Steps</h3>
424411
<code>value</code> parameter being respectively 'true' or 'false') the
425412
messages in the conversation with identifier equal to the <code>conversationID</code>
426413
parameter passed in the request.
427-
<li>Create a new <code>MessagingRequest</code> object and set
428-
<code>readyState</code> of the <code>MessagingRequest</code> object to
429-
'processing' and return the <code>MessagingRequest</code> to the caller.
430-
<li>If there is an error invoke the <code>onerror</code> <a>event
431-
handler</a> of the <code>MessagingRequest</code> object.
432-
<li>When the request has been completed:
414+
<li>Let <var>future</var> be a new <code>Future</code> object and
415+
<var>resolver</var> its associated <code>resolver</code>
416+
<li>Return <var>future</var> to the caller.
417+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
418+
<code>reject(value)</code>method with <var>error</var> as
419+
<code>value</code> argument.
420+
<li>When the request has been successfully completed:
433421
<ol>
434-
<li>Set the <code>readyState</code> of the <code>MessagingRequest</code>
435-
object to 'done'.
436-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
437-
object to 'true'.
438-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
439-
href="#dfn-eventhandler">event handlers</a> of the
440-
<code>MessagingRequest</code>.
422+
<li>Let <var>conversationID</var> be the <code>conversationID</code> parameter
423+
passed in the request
424+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
425+
<var>conversationID</var> as <code>value</code> argument.
441426
</ol>
442427
</ol>
443428

0 commit comments

Comments
 (0)