Skip to content

Commit 7499404

Browse files
authored
Queue a global task to resolve promises (#106)
This change defines a task source for shape detection events, though the only instance where we have explicit method steps which actually resolve a promise is getSupportedFormats(). Fixed #105.
1 parent e516bfc commit 7499404

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.bs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Please see the <a href="https://github.com/WICG/shape-detection-api/blob/master/
4949

5050
Individual browsers MAY provide Detectors indicating the availability of hardware providing accelerated operation.
5151

52+
Detecting features in an image occurs asynchronously, potentially communicating with acceleration hardware independent of the browser. Completion events use the <dfn>shape detection task source</dfn>.
53+
5254
## Image sources for detection ## {#image-sources-for-detection}
5355

5456
<p class="note">
@@ -209,13 +211,13 @@ interface BarcodeDetector {
209211
<dd>This method, when invoked, MUST return a new {{Promise}} |promise| and run the following steps <a>in parallel</a>:
210212
<ol>
211213
<li>Let |supportedFormats| be a new {{Array}}.</li>
212-
<li>If the UA does not support barcode detection, resolve |promise| with |supportedFormats| and abort these steps.</li>
214+
<li>If the UA does not support barcode detection, [=queue a global task=] on the [=relevant global object=] of [=this=] using the [=shape detection task source=] to [=resolve=] |promise| with |supportedFormats| and abort these steps.</li>
213215
<li>Enumerate the {{BarcodeFormat}}s that the UA understands as potentially detectable in images. Add these to |supportedFormats|.
214216
<div class="note">
215217
The UA cannot give a definitive answer as to whether a given barcode format will <i>always</i> be recognized on an image due to e.g. positioning of the symbols or encoding errors. If a given barcode symbology is not in |supportedFormats| array, however, it should not be detectable whatsoever.
216218
</div>
217219
</li>
218-
<li>Resolve |promise| with |supportedFormats|.</li>
220+
<li>[=Queue a global task=] on the [=relevant global object=] of [=this=] using the [=shape detection task source=] to [=resolve=] |promise| with |supportedFormats|.</li>
219221
</ol>
220222
<div class="note">
221223
The list of supported {{BarcodeFormat}}s is platform dependent, some examples are the ones supported by <a href="https://developers.google.com/android/reference/com/google/android/gms/vision/barcode/BarcodeDetector.Builder.html#setBarcodeFormats(int)">Google Play Services</a> and <a href="https://developer.apple.com/documentation/coreimage/ciqrcodefeature?preferredLanguage=occ#overview">Apple's QICRCodeFeature</a>.

0 commit comments

Comments
 (0)