Sha256: 6e107793f0463739a373d60161497cca5be79b526ffd7f9426175704910974ea
Contents?: true
Size: 975 Bytes
Versions: 2
Compression:
Stored size: 975 Bytes
Contents
import React from 'react'; export default function(Component) { return class extends React.Component { static contextTypes = { pageHooks: React.PropTypes.object } componentDidMount() { var component = this.refs.component; this.context.pageHooks.on({ activating: (options) => { trigger('pageWillActivate', options); }, activated: () => { trigger('pageDidActivate'); }, deactivating: () => { trigger('pageDidDeactivate'); }, resize: () => { trigger('pageDidResize'); }, }, this); function trigger(name, options) { if (typeof component[name] === 'function') { component[name].call(component, options); } } } componentWillUnmount() { this.context.pageHooks.off(null, null, this); } render() { return (<Component {...this.props} ref="component" />); } } };
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pageflow-react-0.1.1 | js/src/create_page_component.jsx |
pageflow-react-0.1.0 | js/src/create_page_component.jsx |