@@ -303,29 +303,34 @@ animation as needed by {{AnimationWorkletGlobalScope}}. It consists of:
303
303
304
304
- An <dfn>animator name</dfn> <<ident>> #.
305
305
306
- - A <dfn>class constructor</dfn> which is a <a>VoidFunction</a> <a>callback function</a> type.
306
+ - A <dfn>class constructor</dfn> which is a {{AnimatorInstanceConstructor}} <a>callback function</a> type.
307
307
308
308
- An <dfn>animate function</dfn> which is a <a>Function</a> <a>callback function</a> type.
309
309
310
310
- A <dfn>stateful flag</dfn>
311
311
312
312
313
+
313
314
Registering an Animator Definition {#registering-animator-definition}
314
315
-------------------------------------
315
316
An {{AnimationWorkletGlobalScope}} has a <dfn>animator name to animator definition map</dfn> .
316
- The map gets populated when {{registerAnimator(name, animatorCtorValue )}} is called.
317
+ The map gets populated when {{registerAnimator(name, animatorCtor )}} is called.
317
318
318
319
319
320
<xmp class='idl'>
321
+
320
322
[ Exposed=AnimationWorklet, Global=AnimationWorklet ]
321
323
interface AnimationWorkletGlobalScope : WorkletGlobalScope {
322
- void registerAnimator(DOMString name, VoidFunction animatorCtor);
324
+ void registerAnimator(DOMString name, AnimatorInstanceConstructor animatorCtor);
323
325
};
326
+
327
+ callback AnimatorInstanceConstructor = any (any options, optional any state);
328
+
324
329
</xmp>
325
330
326
331
<div algorithm="register-animator">
327
332
328
- When the <dfn method for=AnimationWorkletGlobalScope>registerAnimator(|name|, |animatorCtorValue |)</dfn>
333
+ When the <dfn method for=AnimationWorkletGlobalScope>registerAnimator(|name|, |animatorCtor |)</dfn>
329
334
method is called in a {{AnimationWorkletGlobalScope}} , the user agent <em> must</em> run the
330
335
following steps:
331
336
@@ -335,14 +340,11 @@ following steps:
335
340
2. If |name| exists as a key in the <a>animator name to animator definition map</a> ,
336
341
<a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
337
342
338
- 3. If the result of <a>IsConstructor</a> (|animatorCtorValue |) is false, <a>throw</a> a
343
+ 3. If the result of <a>IsConstructor</a> (|animatorCtor |) is <b> false</b> , <a>throw</a> a
339
344
<a>TypeError</a> and abort all these steps.
340
345
341
- 4. Let |animatorCtor| be the result of <a>converting</a> animatorCtorValue to the
342
- <a>VoidFunction</a> <a>callback function</a> type. If an exception is thrown, rethrow the
343
- exception and abort all these steps.
344
346
345
- 4. Let |prototype| be the result of <a>Get</a> (|animatorCtorValue |, "prototype").
347
+ 4. Let |prototype| be the result of <a>Get</a> (|animatorCtor |, "prototype").
346
348
347
349
348
350
5. If <a>SameValue</a> (|prototype|, {{StatelessAnimator}} ) is <b> true</b> set |stateful| to be
@@ -426,8 +428,8 @@ To <dfn>create a new animator instance</dfn> given a |name|, |timeline|, |effect
426
428
5. Let |state| be <a>StructuredDeserialize</a> (|serializedState|).
427
429
428
430
6. Let |animatorInstance| be the result of <a>constructing</a> |animatorCtor| with
429
- [ |options|, |state| as args . If an exception is thrown, rethrow the exception and abort all
430
- these steps.
431
+ « |options|, |state|» as arguments . If an exception is thrown, rethrow the exception and
432
+ abort all these steps.
431
433
432
434
7. Set the following on |animatorInstance| with:
433
435
- <a>animator name</a> being |name|
@@ -530,7 +532,7 @@ To <dfn>migrate an animator instance</dfn> from one {{WorkletGlobalScope}} to an
530
532
531
533
3. Let |stateful| be the <a>stateful flag</a> of |definition|.
532
534
533
- 4. If |stateful| is <a >false</a > then abort the following steps.
535
+ 4. If |stateful| is <b > false</b > then abort the following steps.
534
536
535
537
5. Let |state| be the result of <a>Get</a> (|instance|, "state"). If any exception is thrown,
536
538
rethrow the exception and abort the following steps.
0 commit comments