@@ -223,7 +223,7 @@ interface StatelessAnimator {
223223<div class='note'>
224224 This is how the class should look.
225225 <pre class='lang-javascript'>
226- class FooAnimator extends StatelessAnimator{
226+ class FooAnimator extends StatelessAnimator {
227227 constructor(options) {
228228 // Called when a new animator is instantiated.
229229 }
@@ -253,21 +253,21 @@ effect is mutable only in a certain thread). Animation worklet guarantees that a
253253instance's state is maintained even if the instance is respawned in a different global scope.
254254
255255The basic mechanism for maintaining the state is that the animation worklet snapshots the local
256- state that is exposed via {{StatefulAnimator/state}} attribute and then reifies it at a later time
257- to be passed into the constructor when the animator instance is respawned in a potentially different
258- global scope. This processes is specified is details in <a>migrate an animator instance</a>
259- algorithm .
256+ state that is exposed via the {{StatefulAnimator/state}} function and then reifies it so that it can
257+ be passed into the constructor when the animator instance is respawned at a later time in a
258+ potentially different global scope. The <a>migrate an animator instance</a> algorithm specifies this
259+ process in details .
260260
261261A user-defined stateful animator is expected to fulfill the required contract which is that its
262- state attribute is an object representing its state that can be serialized using structured
262+ state function returns an object representing its state that can be serialized using structured
263263serialized algorithm and that it can also recreate its state given that same object passed to
264264its constructor.
265265
266266<xmp class='idl'>
267267[Exposed=AnimationWorklet, Global=AnimationWorklet,
268268Constructor (optional any options, optional any state)]
269269interface StatefulAnimator {
270- attribute any state;
270+ any state() ;
271271};
272272</xmp>
273273
@@ -284,7 +284,7 @@ interface StatefulAnimator {
284284 // Animation frame logic goes here and can rely on this.currentVelocity.
285285 this.currentVelocity += 0.1;
286286 }
287- get state {
287+ state() {
288288 // The returned object should be serializable using structured clonable algorithm.
289289 return {
290290 velocity: this.currentVelocity;
@@ -348,7 +348,7 @@ following steps:
348348
349349
350350 5. If <a>SameValue</a> (|prototype|, {{StatelessAnimator}} ) is <b> true</b> set |stateful| to be
351- <b> false</b> , otherwise if <a>SameValue</a> (|prototype|, {{StatefulAnimator}} ) is
351+ <b> false</b> , otherwise if <a>SameValue</a> (|prototype|, {{StatefulAnimator}} ) is
352352 <b> true</b> set |stateful| to be <b> true</b> , otherwise <a>throw</a> a <a>TypeError</a> and
353353 abort all these steps.
354354
@@ -534,8 +534,9 @@ To <dfn>migrate an animator instance</dfn> from one {{WorkletGlobalScope}} to an
534534
535535 4. If |stateful| is <b> false</b> then abort the following steps.
536536
537- 5. Let |state| be the result of <a>Get</a> (|instance|, "state"). If any exception is thrown,
538- rethrow the exception and abort the following steps.
537+ 5. Let |state| be the result of <a>Invoke</a> |stateFunction| with |instance| as the
538+ <a>callback this value</a> . If any exception is thrown, rethrow the exception and abort
539+ the following steps.
539540
540541 6. Set |serializedState| to be the result of <a>StructuredSerialize</a> (|state|).
541542 If any exception is thrown, then abort the following steps.
0 commit comments