@@ -26,7 +26,12 @@ urlPrefix: https://heycam.github.io/webidl/; type: dfn;
26
26
text: exception
27
27
text: throw
28
28
url: throw; text: thrown
29
- url: es-invoking-callback-functions; text: Invoke
29
+ urlPrefix: #;
30
+ url: Function; text: Function
31
+ url: VoidFunction; text: VoidFunction
32
+ url: invoke-a-callback-function; text: Invoke
33
+ url: construct-a-callback-function; text: constructing
34
+ url: es-type-mapping; text: converting
30
35
urlPrefix: https://html.spec.whatwg.org/#; type: dfn;
31
36
url: run-the-animation-frame-callbacks; text: running the animation frame callbacks
32
37
urlPrefix: http://w3c.github.io/html/infrastructure.html#; type: dfn;
@@ -62,16 +67,13 @@ urlPrefix: https://w3c.github.io/web-animations/level-2/#;
62
67
text: group effect
63
68
text: child effect
64
69
urlPrefix: https://tc39.github.io/ecma262/#sec-; type: dfn;
65
- text: constructor
66
- text: Construct
67
70
text: IsCallable
68
71
text: IsConstructor
69
72
text: HasProperty
70
73
url: ecmascript-data-types-and-values; text: Type
71
74
url: map-objects; text:map object
72
75
url: get-o-p; text: Get
73
76
url: set-o-p-v-throw; text: Set
74
- url: terms-and-definitions-function; text: function
75
77
urlPrefix: native-error-types-used-in-this-standard-
76
78
text: TypeError
77
79
urlPrefix: https://www.w3.org/TR/hr-time-2/#dom-; type: dfn
@@ -178,8 +180,6 @@ partial namespace CSS {
178
180
</xmp>
179
181
180
182
<xmp class='idl'>
181
- callback VoidFunction = void ();
182
-
183
183
[ Exposed=AnimationWorklet, Global=AnimationWorklet ]
184
184
interface AnimationWorkletGlobalScope : WorkletGlobalScope {
185
185
void registerAnimator(DOMString name, VoidFunction animatorCtor);
@@ -210,19 +210,21 @@ animation as needed by {{AnimationWorkletGlobalScope}}. It consists of:
210
210
211
211
- An <dfn>animator name</dfn> <<ident>> #.
212
212
213
- - A <dfn>class constructor</dfn> which is the class <a>constructor</a> .
213
+ - A <dfn>class constructor</dfn> which is a <a>VoidFunction</a> <a>callback function</a> type.
214
+
215
+ - An <dfn>animate function</dfn> which is a <a>Function</a> <a>callback function</a> type.
214
216
215
- - An <dfn>animate function</dfn> which is the animate <a>function</a> callback .
217
+ - A <dfn>destroy function</dfn> which is a <a>Function</a> <a>callback function</a> type .
216
218
217
219
218
220
Registering an Animator Definition {#registering-animator-definition}
219
221
-------------------------------------
220
222
An {{AnimationWorkletGlobalScope}} has a <dfn>animator name to animator definition map</dfn> .
221
- The map gets populated when {{registerAnimator(name, animatorCtor )}} is called.
223
+ The map gets populated when {{registerAnimator(name, animatorCtorValue )}} is called.
222
224
223
225
<div algorithm="register-animator">
224
226
225
- When the <dfn method for=AnimationWorkletGlobalScope>registerAnimator(|name|, |animatorCtor |)</dfn>
227
+ When the <dfn method for=AnimationWorkletGlobalScope>registerAnimator(|name|, |animatorCtorValue |)</dfn>
226
228
method is called in a {{AnimationWorkletGlobalScope}} , the user agent <em> must</em> run the
227
229
following steps:
228
230
@@ -232,28 +234,43 @@ following steps:
232
234
2. If |name| exists as a key in the <a>animator name to animator definition map</a> ,
233
235
<a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
234
236
235
- 3. If the result of <a>IsConstructor</a> (|animatorCtor |) is false, <a>throw</a> a
237
+ 3. If the result of <a>IsConstructor</a> (|animatorCtorValue |) is false, <a>throw</a> a
236
238
<a>TypeError</a> and abort all these steps.
237
239
238
- 4. Let |prototype| be the result of <a>Get</a> (|animatorCtor|, "prototype").
240
+ 4. Let |animatorCtor| be the result of <a>converting</a> animatorCtorValue to the
241
+ <a>VoidFunction</a> <a>callback function</a> type. If an exception is thrown, rethrow the
242
+ exception and abort all these steps.
243
+
244
+ 4. Let |prototype| be the result of <a>Get</a> (|animatorCtorValue|, "prototype").
239
245
240
246
5. If the result of <a>Type</a> (|prototype|) is not Object, <a>throw</a> a <a>TypeError</a>
241
247
and abort all these steps.
242
248
243
- 6. Let |animate| be the result of <a>Get</a> (|prototype|, "animate").
249
+ 6. Let |animateValue| be the result of <a>Get</a> (|prototype|, "animate").
250
+
251
+ 7. Let |animate| be the result of <a>converting</a> |animateValue| to the <a>Function</a>
252
+ <a>callback function</a> type. If an exception is thrown, rethrow the exception and abort
253
+ all these steps.
244
254
245
- 7. If the result of <a>IsCallable</a> (|animate|) is false, <a>throw</a> a <a>TypeError</a> and
246
- abort all these steps.
255
+ 8. Let |destroyValue| be the result of <a>Get</a> (|prototype|, "onDestroy").
247
256
248
- 10. Let |definition| be a new <a>animator definition</a> with:
257
+ 9. Let |destroy| be the result of <a>converting</a> |destroyValue| to the <a>Function</a>
258
+ <a>callback function</a> type. If an exception is thrown, rethrow the exception and abort
259
+ all these steps.
260
+
261
+
262
+ 8. Let |definition| be a new <a>animator definition</a> with:
249
263
250
264
- <a>animator name</a> being |name|
251
265
252
266
- <a>class constructor</a> being |animatorCtor|
253
267
254
268
- <a>animate function</a> being |animate|
255
269
256
- 11. Add the key-value pair (|name| - |definition|) to the <a>animator name to animator
270
+ - <a>destroy function</a> being |destroy|
271
+
272
+
273
+ 9. Add the key-value pair (|name| - |definition|) to the <a>animator name to animator
257
274
definition map</a> .
258
275
</div>
259
276
@@ -308,10 +325,9 @@ To <dfn>create a new animator instance</dfn> given a |name|, |timeline|, |effect
308
325
309
326
5. Let |state| be <a>StructuredDeserialize</a> (|serializedState|).
310
327
311
- 6. Let |animatorInstance| be the result of <a>Construct</a> (|animatorCtor|, [|options|, |state|] ).
312
-
313
- If <a>Construct</a> throws an exception, abort the following steps.
314
-
328
+ 6. Let |animatorInstance| be the result of <a>constructing</a> |animatorCtor| with
329
+ [|options|, |state| as args. If an exception is thrown, rethrow the exception and abort all
330
+ these steps.
315
331
316
332
7. Set the following on |animatorInstance| with:
317
333
- <a>animator name</a> being |name|
@@ -410,22 +426,17 @@ To <dfn>migrate an animator instance</dfn> from one {{WorkletGlobalScope}} to an
410
426
411
427
If |definition| does not exist then abort the following steps.
412
428
413
- 3. Let |animatorCtor | be the <a>class constructor </a> of |definition|.
429
+ 3. Let |destroyFunction | be the <a>destroy function </a> of |definition|.
414
430
415
- 4. Let |prototype| be the result of <a>Get</a> (|animatorCtor|, "prototype").
416
-
417
- 5. Let |onDestroyFunction| be the result of <a>Get</a> (|prototype|, "onDestroy").
418
-
419
- 6. If the result of <a>IsCallable</a> (|onDestroyFunction|) is false then abort the following
420
- steps.
421
431
422
- 7. <a>Invoke</a> |onDestroyFunction| with |instance| as the <a>callback this value</a> and let
423
- |state| be the result of the invocation.
432
+ 4. <a>Invoke</a> |destroyFunction| with |instance| as the <a>callback this value</a> and
433
+ let |state| be the result of the invocation. If any exception is thrown, rethrow the
434
+ exception and abort the following steps.
424
435
425
- 8 . Set |serializedState| to be the result of <a>StructuredSerialize</a> (|state|).
436
+ 5 . Set |serializedState| to be the result of <a>StructuredSerialize</a> (|state|).
426
437
If any exception is thrown, then abort the following steps.
427
438
428
- 9 . Run the procedure to <a>remove an animator instance</a> given |instance|, and
439
+ 6 . Run the procedure to <a>remove an animator instance</a> given |instance|, and
429
440
|sourceWorkletGlobalScope|.
430
441
431
442
2. Wait for the above task to complete. If the task is aborted, abort the following steps.
0 commit comments