Sha256: 7ec0f27e1dcfc94cfb700c1a8e2d3edb6446149f578d4d60f5a2c68bd4efc48f

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# createHelper = (component, name) ->
#     unless component.prototype[name]
#         Object.defineProperty(component.prototype, name,
#             configurable: true, enumerable: true
#             get: -> @data?.states[name]
#             set: (val) ->
#                 @data?.rebind("#{name}": val)
#         )

# extendComponent = (component) ->
#     names = _.keys(component.prototype.dataObjects).concat(['collection', 'model'])
#     for name in _.uniq(names)
#         createHelper(component, name)

Lanes.React.Component = {

    defaultMixins: [
        Lanes.Vendor.ReactModelMixin
        Lanes.React.Mixins.Data
        Lanes.React.Mixins.Viewport
        Lanes.React.Mixins.Component
    ]

    extend: (klass, mixins = @defaultMixins) ->
        klass::mixins ||= []
        klass::mixins = _.uniq(klass::mixins.concat(mixins))
        comp = React.createClass(klass.prototype)
#        extendComponent(comp)
        return Lanes.lib.HotReload?.remember(comp) or comp
}

Lanes.React.BaseComponent = {
    extend: (klass) ->
        comp = React.createClass(klass.prototype)
        return Lanes.lib.HotReload?.remember(comp) or comp
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.7.0 client/lanes/react/Component.coffee
lanes-0.6.1 client/lanes/react/Component.coffee
lanes-0.6.0 client/lanes/react/Component.coffee