You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The state defined with Type-R classes is deeply observable and serializable by default. While being an advanced JSON serialization engine handling sophisticated scenarios (like cross-collections many-to-many relationships), Type-R is completely unopinionated on the client-server transport protocol.</p>
83
83
<p>Type-R is your perfect M and VM in MVVM and MVC architecture imposing no restrictions on V and C parts.</p>
84
-
<pre><code><spanclass="hljs-keyword">import</span> { define, Record } <spanclass="hljs-keyword">from</span><spanclass="hljs-string">'type-r'</span>
84
+
<pre><codeclass="highlight javascript"><spanclass="hljs-keyword">import</span> { define, Record } <spanclass="hljs-keyword">from</span><spanclass="hljs-string">'type-r'</span>
85
85
86
+
<spanclass="hljs-comment">// Define email attribute type with encapsulated validation check.</span>
<spanclass="hljs-attr">name</span> : <spanclass="hljs-built_in">String</span>.isRequired,<spanclass="hljs-comment">// should not be empty for the record to be valid.</span>
msg.transaction( <spanclass="hljs-function"><spanclass="hljs-params">()</span> =></span> { <spanclass="hljs-comment">// Prepare to make the sequence of changes on msg</span>
113
+
msg.author.name = <spanclass="hljs-string">'John Dee'</span>; <spanclass="hljs-comment">// No 'change' event yet as we're in the transaction. </span>
0 commit comments