Skip to content

Commit cce303b

Browse files
committed
Editorial: move "common APIs" section under "Shared infrastructure"
1 parent c5a22ca commit cce303b

File tree

1 file changed

+65
-66
lines changed

1 file changed

+65
-66
lines changed

index.bs

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -52,72 +52,6 @@ p + dl.props { margin-top: -0.5em; }
5252

5353
For now, see the [explainer](https://github.com/webmachinelearning/writing-assistance-apis/blob/main/README.md).
5454

55-
<h2 id="shared-apis">Shared APIs</h2>
56-
57-
<xmp class="idl">
58-
[Exposed=Window, SecureContext]
59-
interface CreateMonitor : EventTarget {
60-
attribute EventHandler ondownloadprogress;
61-
};
62-
63-
callback CreateMonitorCallback = undefined (CreateMonitor monitor);
64-
65-
enum Availability {
66-
"unavailable",
67-
"downloadable",
68-
"downloading",
69-
"available"
70-
};
71-
72-
interface mixin DestroyableModel {
73-
undefined destroy();
74-
};
75-
</xmp>
76-
77-
<hr>
78-
79-
The following are the [=event handlers=] (and their corresponding [=event handler event types=]) that must be supported, as [=event handler IDL attributes=], by all {{CreateMonitor}} objects:
80-
81-
<table>
82-
<thead>
83-
<tr>
84-
<th>[=Event handler=]
85-
<th>[=Event handler event type=]
86-
<tbody>
87-
<tr>
88-
<td><dfn attribute for="CreateMonitor">ondownloadprogress</dfn>
89-
<td><dfn event for="CreateMonitor">downloadprogress</dfn>
90-
</table>
91-
92-
<hr>
93-
94-
Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface mixin has a <dfn export for="DestroyableModel">destruction abort controller</dfn>, an {{AbortController}}, set by the [=initialize as a destroyable=] algorithm.
95-
96-
<p class="note">The [=DestroyableModel/destruction abort controller=] is only used internally, as a way of tracking calls to {{DestroyableModel/destroy()}}. Since it is easy to combine multiple {{AbortSignal}}s using [=create a dependent abort signal=], this lets us centralize handling of any {{AbortSignal}} the web developer provides to specific method calls, with any calls to {{DestroyableModel/destroy()}}.
97-
98-
<div algorithm>
99-
To <dfn>initialize as a destroyable</dfn> an {{DestroyableModel}} object |destroyable|:
100-
101-
1. Let |controller| be a [=new=] {{AbortController}} created in |destroyable|'s [=relevant realm=].
102-
103-
1. Set |controller|'s [=AbortController/signal=] to a [=new=] {{AbortSignal}} created in |destroyable|'s [=relevant realm=].
104-
105-
1. Set |destroyable|'s [=DestroyableModel/destruction abort controller=] to |controller|.
106-
</div>
107-
108-
<div algorithm>
109-
<p>The <dfn method for="DestroyableModel">destroy()</dfn> method steps are to [=DestroyableModel/destroy=] [=this=] given a new "{{AbortError}}" {{DOMException}}.
110-
</div>
111-
112-
<div algorithm>
113-
To <dfn for="DestroyableModel">destroy</dfn> an {{DestroyableModel}} |destroyable|, given a JavaScript value |reason|:
114-
115-
1. [=AbortController/Signal abort=] given |destroyable|'s [=DestroyableModel/destruction abort controller=] and |reason|.
116-
117-
1. The user agent should release any resources associated with |destroyable|, such as AI models loaded to support its operation, as long as those resources are not needed for other ongoing operations.
118-
</div>
119-
120-
12155
<h2 id="summarizer-api">The summarizer API</h2>
12256

12357
<xmp class="idl">
@@ -1720,6 +1654,71 @@ Access to the rewriter API is gated behind the [=policy-controlled feature=] "<d
17201654

17211655
<h2 id="supporting">Shared infrastructure</h2>
17221656

1657+
<h3 id="shared-apis">Common APIs</h3>
1658+
1659+
<xmp class="idl">
1660+
[Exposed=Window, SecureContext]
1661+
interface CreateMonitor : EventTarget {
1662+
attribute EventHandler ondownloadprogress;
1663+
};
1664+
1665+
callback CreateMonitorCallback = undefined (CreateMonitor monitor);
1666+
1667+
enum Availability {
1668+
"unavailable",
1669+
"downloadable",
1670+
"downloading",
1671+
"available"
1672+
};
1673+
1674+
interface mixin DestroyableModel {
1675+
undefined destroy();
1676+
};
1677+
</xmp>
1678+
1679+
<hr>
1680+
1681+
The following are the [=event handlers=] (and their corresponding [=event handler event types=]) that must be supported, as [=event handler IDL attributes=], by all {{CreateMonitor}} objects:
1682+
1683+
<table>
1684+
<thead>
1685+
<tr>
1686+
<th>[=Event handler=]
1687+
<th>[=Event handler event type=]
1688+
<tbody>
1689+
<tr>
1690+
<td><dfn attribute for="CreateMonitor">ondownloadprogress</dfn>
1691+
<td><dfn event for="CreateMonitor">downloadprogress</dfn>
1692+
</table>
1693+
1694+
<hr>
1695+
1696+
Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface mixin has a <dfn export for="DestroyableModel">destruction abort controller</dfn>, an {{AbortController}}, set by the [=initialize as a destroyable=] algorithm.
1697+
1698+
<p class="note">The [=DestroyableModel/destruction abort controller=] is only used internally, as a way of tracking calls to {{DestroyableModel/destroy()}}. Since it is easy to combine multiple {{AbortSignal}}s using [=create a dependent abort signal=], this lets us centralize handling of any {{AbortSignal}} the web developer provides to specific method calls, with any calls to {{DestroyableModel/destroy()}}.
1699+
1700+
<div algorithm>
1701+
To <dfn>initialize as a destroyable</dfn> an {{DestroyableModel}} object |destroyable|:
1702+
1703+
1. Let |controller| be a [=new=] {{AbortController}} created in |destroyable|'s [=relevant realm=].
1704+
1705+
1. Set |controller|'s [=AbortController/signal=] to a [=new=] {{AbortSignal}} created in |destroyable|'s [=relevant realm=].
1706+
1707+
1. Set |destroyable|'s [=DestroyableModel/destruction abort controller=] to |controller|.
1708+
</div>
1709+
1710+
<div algorithm>
1711+
<p>The <dfn method for="DestroyableModel">destroy()</dfn> method steps are to [=DestroyableModel/destroy=] [=this=] given a new "{{AbortError}}" {{DOMException}}.
1712+
</div>
1713+
1714+
<div algorithm>
1715+
To <dfn for="DestroyableModel">destroy</dfn> an {{DestroyableModel}} |destroyable|, given a JavaScript value |reason|:
1716+
1717+
1. [=AbortController/Signal abort=] given |destroyable|'s [=DestroyableModel/destruction abort controller=] and |reason|.
1718+
1719+
1. The user agent should release any resources associated with |destroyable|, such as AI models loaded to support its operation, as long as those resources are not needed for other ongoing operations.
1720+
</div>
1721+
17231722
<h3 id="supporting-creation">Creation</h3>
17241723

17251724
<div algorithm>

0 commit comments

Comments
 (0)