Module: LucidMaterial::Func::Initializer

Defined in:
lib/lucid_material/func/initializer.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/lucid_material/func/initializer.rb', line 4

def initialize
  self.JS[:native_props] = `{ props: null }`
  @native_props = `Opal.React.Component.Props.$new(#{self})`
  @app_store = `Opal.LucidComponent.AppStoreProxy.$new(#{self})`
  @class_store = `Opal.LucidComponent.ClassStoreProxy.$new(#{self})`
  @store = `Opal.LucidComponent.InstanceStoreProxy.$new(#{self})`
  event_handlers = self.class.event_handlers
  event_handler_source = self.class
  %x{
    for (var i = 0; i < event_handlers.length; i++) {
      self[event_handlers[i]] = event_handler_source[event_handlers[i]];
      self[event_handlers[i]] = self[event_handlers[i]].bind(self);
    }
  }
end