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

Commit 3076b26

Browse files
author
Eduardo Fullea
committed
Futures in SmsManager
1 parent 21a9f43 commit 3076b26

File tree

1 file changed

+28
-38
lines changed

1 file changed

+28
-38
lines changed

index.html

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,11 @@ <h2><a>SmsManager</a> Interface</h2>
471471
</dl>
472472
</dd>
473473

474-
<dt> MessagingRequest send ()</dt>
474+
<dt> Future send ()</dt>
475475
<dd>This method issues a request to the messaging system to send an SMS
476476
message with the text of the <code>text</code> parameter to the destination
477477
number indicated in the <code>to</code> parameter.
478-
A <code>MessagingRequest</code> object will be returned in order to notify
478+
A <code>Future</code> object will be returned in order to notify
479479
the result of the request.
480480
<dl class='parameters'>
481481
<dt>DOMString to</dt>
@@ -494,7 +494,7 @@ <h2><a>SmsManager</a> Interface</h2>
494494
</dl>
495495
</dd>
496496

497-
<dt>MessagingRequest clear ()</dt>
497+
<dt>Future clear ()</dt>
498498
<dd>This method makes a request to delete all the messages associated to the
499499
messaging service passed as parameter.
500500
<dl class='parameters'>
@@ -554,8 +554,7 @@ <h3>Steps</h3>
554554
<p> The <dfn><code>send</code></dfn> method when invoked MUST run the
555555
following steps:
556556
<ol>
557-
<li>Create a new instance of <code>SmsMessage</code> and a new instance of
558-
<code>MessagingRequest</code> and:
557+
<li>Create a new instance of <code>SmsMessage</code>:
559558
<ol>
560559
<li>Generate a identifier for this message that is globally unique within
561560
the implementation, i.e. there cannot be any other message with the same
@@ -586,40 +585,33 @@ <h3>Steps</h3>
586585
in the <code>text</code> parameter to the number of the recipient
587586
indicated in the <code>to</code> parameter, using the proper service as
588587
described above.
589-
<li>Set <code>readyState</code> of the <code>MessagingRequest</code>
590-
object to 'processing'.
591-
<li>Return the <code>MessagingRequest</code> to the caller and <a>queue a
592-
task</a> to monitor SMS sending progress.
588+
<li><a>Queue a task</a> to monitor SMS sending progress.
593589
</ol>
594-
<li>If there is an error
590+
<li>Let <var>future</var> be a new <code>Future</code> object and
591+
<var>resolver</var> its associated <code>resolver</code>
592+
<li>Return <var>future</var> to the caller.
593+
<li>If an <var>error</var> occurs run these substeps and terminate these
594+
steps
595595
<ol>
596-
<li>Set the <code>state</code> of the <code>SmsMessage</code> to
597-
'error'.
598596
<li>If a delivery report had been requested set the
599597
<code>deliveryStatus</code> of the <code>SmsMessage</code> to 'error'.
600-
<li>Invoke the <code>onerror</code> <a class="internalDFN"
601-
href="#dfn-eventhandler">event handlers</a> of the
602-
<code>MessagingRequest</code> object.
598+
<li>call <var>resolver</var>'s <code>reject(value)</code>method with
599+
<var>error</var> as <code>value</code> argument.
603600
</ol>
604-
<li>When the requests has been completed:
601+
<li>When the request has been successfully completed:
605602
<ol>
606603
<li>Set the <code>state</code> of the <code>SmsMessage</code> to 'sent'.
607604
<li>Set the <code>timestamp</code> of the <code>SmsMessage</code> to the
608605
timestamp when the SMS message reached the Short Message Center, i.e. the
609606
value of the TP-Service-Centre-Time-Stamp (TP-SCTS) parameter returned in
610607
the SMS-SUBMIT-REPORT Protocol Data Unit.
611-
<li>Set the <code>readyState</code> of the <code>MessagingRequest</code>
612-
object to 'done'.
613-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
614-
object to the <code>SmsMessage</code> that has been sent.
615-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
616-
href="#dfn-eventhandler">event handlers</a> of the
617-
<code>MessagingRequest</code>.
608+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
609+
the sent <code>SmsMessage</code> as <code>value</code> argument.
618610
<li><a>Queue a task</a> to <a>fire an event</a> named <code>sent</code>
619611
with the <code>message</code> attribute set to the sent
620-
<code>MmsMessage</code>.
621-
</ol>
612+
<code>SmsMessage</code>.
622613
</ol>
614+
</ol>
623615

624616
<p> The <dfn><code>getSegmentInfoForText</code></dfn> method when invoked MUST
625617
return a <code>SmsSegmentInfo</code> object that contains the following
@@ -710,20 +702,18 @@ <h3>Steps</h3>
710702
<li>Make a request to the system to delete all the messages associated to
711703
the messaging service with identifier equal to the <code>serviceID</code>
712704
parameter.
713-
<li>Create a new <code>MessagingRequest</code> object and set
714-
<code>readyState</code> of the <code>MessagingRequest</code> object to
715-
'processing' and return the <code>MessagingRequest</code> to the caller.
716-
<li>If there is an error invoke the <code>onerror</code> <a>event
717-
handler</a> of the <code>MessagingRequest</code> object.
718-
<li>When the request has been completed:
705+
<li>Let <var>future</var> be a new <code>Future</code> object and
706+
<var>resolver</var> its associated <code>resolver</code>
707+
<li>Return <var>future</var> to the caller.
708+
<li>If an <var>error</var> occurs call <var>resolver</var>'s
709+
<code>reject(value)</code>method with <var>error</var> as
710+
<code>value</code> argument.
711+
<li>When the request has been successfully completed:
719712
<ol>
720-
<li>Set the <code>readyState</code> of the
721-
<code>MessagingRequest</code> object to 'done'.
722-
<li>Set the <code>result</code> of the <code>MessagingRequest</code>
723-
object to 'true'.
724-
<li>Invoke the <code>onsuccess</code> <a class="internalDFN"
725-
href="#dfn-eventhandler">event handlers</a> of the
726-
<code>MessagingRequest</code>.
713+
<li>Let <var>serviceID</var> be the <code>serviceID</code> parameter
714+
passed in the request
715+
<li>Call <var>resolver</var>'s <code>accept(value)</code>method with
716+
<var>serviceID</var> as <code>value</code> argument.
727717
</ol>
728718
</ol>
729719
</section>

0 commit comments

Comments
 (0)