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
{{ message }}
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
Copy file name to clipboardexpand all lines: DOCS.md
+4-12
Original file line number
Diff line number
Diff line change
@@ -612,11 +612,7 @@ Ruby has a rich set of mechanisms enabling code reuse, and Hyperloop is intended
612
612
One common use case is a component wanting to update itself on a time interval. It's easy to use the kernel method `every`, but it's important to cancel your interval when you don't need it anymore to save memory. React provides [lifecycle methods](/docs/working-with-the-browser.html#component-lifecycle) that let you know when a component is about to be created or destroyed. Let's create a simple mixin that uses these methods to provide a React friendly `every` function that will automatically get cleaned up when your component is destroyed.
613
613
614
614
615
-
<div class="codemirror-live-edit"
616
-
data-heading="Using state"
617
-
data-rows=33
618
-
data-top-level-component="TickTock">
619
-
<pre>
615
+
```ruby runable
620
616
moduleReactInterval
621
617
622
618
defself.included(base)
@@ -649,7 +645,7 @@ class TickTock < Hyperloop::Component
649
645
"Hyperloop has been running for #{state.seconds} seconds".para
650
646
end
651
647
end
652
-
</pre></div>
648
+
```
653
649
654
650
Notice that TickTock effectively has two before_mount callbacks, one that is called to initialize the `@intervals` array and another to initialize `state.seconds`
655
651
@@ -798,11 +794,7 @@ Along with params components may be passed a block which is used to build the co
798
794
799
795
The instance method `children` returns an enumerable that is used to access the unrendered children of a component.
800
796
801
-
<div class="codemirror-live-edit"
802
-
data-heading="The children method"
803
-
data-rows=20
804
-
data-top-level-component="Indenter">
805
-
<pre>
797
+
```ruby runable
806
798
classIndentEachLine < Hyperloop::Component
807
799
param by:20, type:Integer
808
800
@@ -822,7 +814,7 @@ class Indenter < Hyperloop::Component
0 commit comments