Skip to content

Commit 0c7a74d

Browse files
committed
spec: Added a non-normative section discussing extending the API.
1 parent 8c02b22 commit 0c7a74d

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

index.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,60 @@ <h2>
388388
</li>
389389
</ul>
390390
</section>
391+
<section class="appendix informative">
392+
<h2>
393+
Extensibility of this API
394+
</h2>
395+
<p>
396+
The Web Share API is designed to be extended in the future by way of
397+
new members added to to the <a>ShareData</a> dictionary, to allow both
398+
sharing of new types of data (<i>e.g.</i>, <a href=
399+
"https://github.com/WICG/web-share/issues/12">images</a>) and strings
400+
with new semantics (<i>e.g.</i> author).
401+
</p>
402+
<div class="warning">
403+
This doesn't mean user agents can add whatever members they like. It
404+
means that new members can be added to the standard in the future.
405+
</div>
406+
<p>
407+
The three members <a for="ShareData">title</a>, <a for=
408+
"ShareData">text</a>, and <a for="ShareData">url</a>, are part of the
409+
base feature set, and implementations that provide
410+
<a><code>navigator.share</code></a> need to accept all three. Any new
411+
members that are added in the future will be <em>individually
412+
feature-detectable</em>, to allow for backwards-compatibility with
413+
older implementations that don't recognise those members. These new
414+
members might also be added as optional "MAY" requirements.
415+
</p>
416+
<div class="note">
417+
There is <a href="https://github.com/heycam/webidl/issues/107">an open
418+
discussion</a> about how to provide feature-detection for dictionary
419+
members. Web Share will use the mechanism produced by that discussion.
420+
</div>
421+
<p>
422+
The <a for="Navigator"><code>share</code></a> method throws a
423+
<a data-cite=
424+
"!WEBIDL#exceptiondef-typeerror"><code>TypeError</code></a> if none of
425+
the specified members are present. The intention is that when a new
426+
member is added, it will also be added to this list of recognised
427+
members (so as to not throw an error). This is for future-proofing
428+
implementations: if a web site written against a future version of this
429+
spec uses <em>only</em> new members (<i>e.g.</i>,
430+
<code>navigator.share({image: x})</code>), it will be valid in future
431+
user agents, but a <a data-cite=
432+
"!WEBIDL#exceptiondef-typeerror"><code>TypeError</code></a> on user
433+
agents implementing an older version of the spec. Developers will be
434+
asked to feature-detect any new fields they rely on, to avoid having
435+
errors surface in their program.
436+
</p>
437+
<p>
438+
Editors of this spec will want to carefully consider the genericity of
439+
any new members being added, avoiding fields that are closely
440+
associated with a particular service, user agent or operating system,
441+
in favour of fields that can potentially be applied to a wide range of
442+
platforms and targets.
443+
</p>
444+
</section>
391445
<section class="appendix">
392446
<h2>
393447
Acknowledgments

0 commit comments

Comments
 (0)