|
| 1 | +<%- @modules.each do |module_name| %><%= " "* @indet %>module <%= module_name.camelize %><%- @indet += 1 %> |
| 2 | +<%- end %><%=" "* @indet %>class <%= @file_name %> < Hyperloop::Component |
| 3 | +
|
| 4 | +<%=" "* @indet %># param :my_param |
| 5 | +<%=" "* @indet %># param param_with_default: "default value" |
| 6 | +<%=" "* @indet %># param :param_with_default2, default: "default value" # alternative syntax |
| 7 | +<%=" "* @indet %># param :param_with_type, type: Hash |
| 8 | +<%=" "* @indet %># param :array_of_hashes, type: [Hash] |
| 9 | +<%=" "* @indet %># collect_other_params_as :attributes # collects all other params into a hash |
| 10 | +
|
| 11 | +<%=" "* @indet %># The following are the most common lifecycle call backs, |
| 12 | +<%=" "* @indet %># the following are the most common lifecycle call backs# delete any that you are not using. |
| 13 | +<%=" "* @indet %># call backs may also reference an instance method i.e. before_mount :my_method |
| 14 | +
|
| 15 | +<%=" "* @indet %>before_mount do |
| 16 | +<%=" "* @indet %> # any initialization particularly of state variables goes here. |
| 17 | +<%=" "* @indet %> # this will execute on server (prerendering) and client. |
| 18 | +<%=" "* @indet %>end |
1 | 19 |
|
2 | | - <%- @modules.each do |module_name| %><%= " "* @indet %>module <%= module_name.camelize %><%- @indet += 1 %> |
3 | | - <%- end %><%=" "* @indet %>class <%= @file_name %> < Hyperloop::Component |
4 | | -
|
5 | | - <%=" "* @indet %># param :my_param |
6 | | - <%=" "* @indet %># param param_with_default: "default value" |
7 | | - <%=" "* @indet %># param :param_with_default2, default: "default value" # alternative syntax |
8 | | - <%=" "* @indet %># param :param_with_type, type: Hash |
9 | | - <%=" "* @indet %># param :array_of_hashes, type: [Hash] |
10 | | - <%=" "* @indet %># collect_other_params_as :attributes # collects all other params into a hash |
11 | | -
|
12 | | - <%=" "* @indet %># The following are the most common lifecycle call backs, |
13 | | - <%=" "* @indet %># the following are the most common lifecycle call backs# delete any that you are not using. |
14 | | - <%=" "* @indet %># call backs may also reference an instance method i.e. before_mount :my_method |
15 | | -
|
16 | | - <%=" "* @indet %>before_mount do |
17 | | - <%=" "* @indet %> # any initialization particularly of state variables goes here. |
18 | | - <%=" "* @indet %> # this will execute on server (prerendering) and client. |
19 | | - <%=" "* @indet %>end |
20 | | -
|
21 | | - <%=" "* @indet %>after_mount do |
22 | | - <%=" "* @indet %> # any client only post rendering initialization goes here. |
23 | | - <%=" "* @indet %> # i.e. start timers, HTTP requests, and low level jquery operations etc. |
24 | | - <%=" "* @indet %>end |
| 20 | +<%=" "* @indet %>after_mount do |
| 21 | +<%=" "* @indet %> # any client only post rendering initialization goes here. |
| 22 | +<%=" "* @indet %> # i.e. start timers, HTTP requests, and low level jquery operations etc. |
| 23 | +<%=" "* @indet %>end |
25 | 24 |
|
26 | | - <%=" "* @indet %>before_update do |
27 | | - <%=" "* @indet %> # called whenever a component will be re-rerendered |
28 | | - <%=" "* @indet %>end |
| 25 | +<%=" "* @indet %>before_update do |
| 26 | +<%=" "* @indet %> # called whenever a component will be re-rerendered |
| 27 | +<%=" "* @indet %>end |
29 | 28 |
|
30 | | - <%=" "* @indet %>before_unmount do |
31 | | - <%=" "* @indet %> # cleanup any thing (i.e. timers) before component is destroyed |
32 | | - <%=" "* @indet %>end |
| 29 | +<%=" "* @indet %>before_unmount do |
| 30 | +<%=" "* @indet %> # cleanup any thing (i.e. timers) before component is destroyed |
| 31 | +<%=" "* @indet %>end |
33 | 32 |
|
34 | | - <%=" "* @indet %>def render |
35 | | - <%=" "* @indet %> DIV do |
36 | | - <%=" "* @indet %> "<%= (@modules+[@file_name]).join('::') %>" |
37 | | - <%=" "* @indet %> end |
38 | | - <%=" "* @indet %>end |
| 33 | +<%=" "* @indet %>def render |
| 34 | +<%=" "* @indet %> DIV do |
| 35 | +<%=" "* @indet %> "<%= (@modules+[@file_name]).join('::') %>" |
| 36 | +<%=" "* @indet %> end |
| 37 | +<%=" "* @indet %>end |
39 | 38 | <%=" "* @indet %>end |
40 | | - <%- @modules.each do %><%- @indet -= 1 %><%=" "* @indet %>end |
41 | | - <%- end %> |
| 39 | +<%- @modules.each do %><%- @indet -= 1 %><%=" "* @indet %>end |
| 40 | +<%- end %> |
0 commit comments