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>Tell an object to listen to a particular event on an other object. The advantage of using this form, instead of other.on(event, callback, object), is that listenTo allows the object to keep track of the events, and they can be removed all at once later on. The callback will always be called with object as context.</p>
<p>Tell an object to stop listening to events. Either call stopListening with no arguments to have the object remove all of its registered callbacks ... or be more precise by telling it to remove just the events it's listening to on a specific object, or a specific event, or just a specific callback.</p>
102
-
<pre><code>view.stopListening();
102
+
<pre><code>view.stopListening(); // Unsubscribe from all events
103
103
104
-
view.stopListening(model);
104
+
view.stopListening(model); // Unsubscribe from all events from the model
105
105
</code></pre>
106
+
<p>All Type-R classes execute <code>this.stopListening()</code> from their <code>dispose()</code> method.</p>
<ahref="https://github.com/Volicon/React-MVx/blob/develop/docs/08_Mixins.md" target="_blank">Edit on GitHub</a>
78
+
</span>
79
+
</div>
80
+
81
+
82
+
<divclass="s-content">
83
+
<p>Both plain JS object and class constructor may be used as mixins. In the case of the class constructor, missing static members will copied over as well.</p>
84
+
<h3id="page_%40mixins%28+mixinA%2C+mixinB%2C+...+%29+class+..."><code>decorator</code> @mixins( mixinA, mixinB, ... ) class ...</h3>
85
+
<p>You need to import mixins decorator to use mixins:</p>
<h3id="page_%40mixinRules%28%7B+name+%3A++%2C+...+%7D%29+class+...+%60"><code>decorator</code> @mixinRules({ name : <code>rule</code>, ... }) class ...`</h3>
96
+
<p>Define configurable properties merge rules for the specific class. Rules can be extented in any subclass.</p>
97
+
<h2id="page_Mixin+rules">Mixin rules</h2>
98
+
<h3id="page_name+%3A+%27merge%27"><code>rule</code> name : 'merge'</h3>
99
+
<p>Assume the property to be an object. Property values from mixins will be merged.</p>
100
+
<h3id="page_name+%3A+%7B+name1+%3A++%2C+...+%7D"><code>rule</code> name : { name1 : <code>rule</code>, ... }</h3>
101
+
<p>If merge rule is an object, the corresponding member is expected to be an object and the rule defines the merge rules for its members.</p>
102
+
<h3id="page_name+%3A+%27pipe%27"><code>rule</code> name : 'pipe'</h3>
103
+
<p>Property is the function ( x : T ) => T transforming the value. Multiple functions joined in pipe.</p>
104
+
<h3id="page_name+%3A+%27sequence%27"><code>rule</code> name : 'sequence'</h3>
105
+
<p>Property is the function. Multiple functions will be called in sequence.</p>
106
+
<h3id="page_name+%3A+%27reverse%27"><code>rule</code> name : 'reverse'</h3>
107
+
<p>Same as sequence, but functions called in reverse sequence.</p>
108
+
<h3id="page_name+%3A+%27mergeSequence%27"><code>rule</code> name : 'mergeSequence'</h3>
109
+
<p>Merge the object returned by functions, executing them in sequence.</p>
110
+
<h3id="page_name+%3A+%27every%27"><code>rule</code> name : 'every'</h3>
111
+
<p>Property is the function ( ...args : any[] ) => boolean. Resulting method will return true if every single function returns true.</p>
112
+
<h3id="page_name+%3A+%27some%27"><code>rule</code> name : 'some'</h3>
113
+
<p>Same as <code>every</code>, but method will return true when at least one function returns true.</p>
0 commit comments