Sha256: 3492454da035e6cb82497ae6e674d6ce56ded4050d0695176b4c654c40ffcc00

Contents?: true

Size: 1.9 KB

Versions: 7

Compression:

Stored size: 1.9 KB

Contents

<%- @modules.each do |module_name| %><%= "  "* @indent %>module <%= module_name.camelize %><%- @indent += 1 %>
<%- end %><%="  "* @indent %>class <%= @file_name %> < Hyperloop::Component

<%="  "* @indent %>  # param :my_param
<%="  "* @indent %>  # param param_with_default: "default value"
<%="  "* @indent %>  # param :param_with_default2, default: "default value" # alternative syntax
<%="  "* @indent %>  # param :param_with_type, type: Hash
<%="  "* @indent %>  # param :array_of_hashes, type: [Hash]
<%="  "* @indent %>  # collect_other_params_as :attributes  # collects all other params into a hash

<%="  "* @indent %>  # The following are the most common lifecycle call backs,
<%="  "* @indent %>  # the following are the most common lifecycle call backs# delete any that you are not using.
<%="  "* @indent %>  # call backs may also reference an instance method i.e. before_mount :my_method

<%="  "* @indent %>  before_mount do
<%="  "* @indent %>    # any initialization particularly of state variables goes here.
<%="  "* @indent %>    # this will execute on server (prerendering) and client.
<%="  "* @indent %>  end

<%="  "* @indent %>  after_mount do
<%="  "* @indent %>    # any client only post rendering initialization goes here.
<%="  "* @indent %>    # i.e. start timers, HTTP requests, and low level jquery operations etc.
<%="  "* @indent %>  end

<%="  "* @indent %>  before_update do
<%="  "* @indent %>    # called whenever a component will be re-rerendered
<%="  "* @indent %>  end

<%="  "* @indent %>  before_unmount do
<%="  "* @indent %>    # cleanup any thing (i.e. timers) before component is destroyed
<%="  "* @indent %>  end

<%="  "* @indent %>  render do
<%="  "* @indent %>    DIV do
<%="  "* @indent %>      "<%= (@modules+[@file_name]).join('::') %>"
<%="  "* @indent %>    end
<%="  "* @indent %>  end
<%="  "* @indent %>end
<%- @modules.each do %><%- @indent -= 1 %><%="  "* @indent %>end
<%- end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyperloop-0.99.6 lib/generators/hyper/templates/component_template.rb
hyperloop-0.99.5 lib/generators/hyper/templates/component_template.rb
hyperloop-0.99.4 lib/generators/hyper/templates/component_template.rb
hyperloop-0.99.3 lib/generators/hyper/templates/component_template.rb
hyperloop-0.99.2 lib/generators/hyper/templates/component_template.rb
hyperloop-0.99.1 lib/generators/hyper/templates/component_template.rb
hyperloop-0.99.0 lib/generators/hyper/templates/component_template.rb