Sha256: 3bc084383fc4c0ef89b9f651604082d23be22cc97d57b870d092bd113ddaabbd

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

import React from 'react';
import ReactDOM from 'react-dom';

export default function(Component) {
  return {
    scroller: false,

    enhance(pageElement) {
      this._pageHooks = {...Backbone.Events};
      this._isPreloaded = false;

      this._render(pageElement);
    },

    preload(pageElement) {
      this._isPreloaded = true;
      this._render(pageElement);
    },

    activating(elelement, configuration, options) {
      this._pageHooks.trigger('activating', options);
    },

    activated() {
      this._pageHooks.trigger('activated');
    },

    deactivating() {
      this._pageHooks.trigger('deactivating');
    },

    deactivated() {
      this._pageHooks.trigger('deactivated');
    },

    resize() {
      this._pageHooks.trigger('resize');
    },

    update(pageElement, configuration) {
      pageflow.commonPageCssClasses.updateCommonPageCssClasses(pageElement, configuration);
    },

    cleanup(pageElement) {
      ReactDOM.unmountComponentAtNode(pageElement[0]);
    },

    _render(pageElement) {
      ReactDOM.render(React.createElement(Component, {
        resolverSeed: pageflow.seed,
        pageId: parseInt(pageElement.attr('id'), 10),
        pageHooks: this._pageHooks,
        isPreloaded: this._isPreloaded
      }), pageElement[0]);
    }
  };
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-react-0.1.1 js/src/create_page_type.js
pageflow-react-0.1.0 js/src/create_page_type.js