Re: [heycam/webidl] Replace serializers by toJSON and [Default] extended attribute (#323)

tobie commented on this pull request.



> +          [Default] any toJSON();
+        };
+    </pre>
+
+    Assuming each of the attributes of <code class="idl">Transaction</code> is backed by an associated value,
+    so that each [=attribute getter=] returns the corresponding associated value,
+    then the “toJSON” [=regular operation=] could be defined as follows:
+
+    <blockquote>
+        <div algorithm="example tojson">
+
+            The “toJSON” operation of the <code class="idl">Transaction</code> interface
+            must follow these steps:
+
+            1.  Let |json| be a new <code class="idl">TransactionJSONValue</code> dictionary.
+            1.  Set |json|[“from”] to this <code class="idl">Transaction</code>'s associated "from" value.

Man, I saw those elsewhere in the spec and duly copied them. Good thing we have a document convention section where all this stuff is clarified. :D

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/323#discussion_r104272342

Received on Saturday, 4 March 2017 01:12:28 UTC