-
Notifications
You must be signed in to change notification settings - Fork 14
/
react-swf-compat.min.js
2 lines (2 loc) · 1.48 KB
/
react-swf-compat.min.js
1
2
/*! react-swf v1.0.7 | @syranide | MIT license */
!function(e,t){"function"==typeof define&&define.amd?define(["prop-types","react","react-dom","react-dom/server","react-swf"],t):"object"==typeof exports?module.exports=t(require("prop-types"),require("react"),require("react-dom"),require("react-dom/server"),require("react-swf")):e.ReactSWFCompat=t(e.PropTypes,e.React,e.ReactDOM,e.ReactDOMServer,e.ReactSWF)}(this,function(e,t,n,r,o){"use strict";function c(e){t.Component.call(this,e);var n=this;this._containerRefCallback=function(e){n._container=e},this._swfRefCallback=function(e){n._swf=e}}return c.prototype=Object.create(t.Component.prototype),c.prototype.constructor=c,Object.assign(c,t.Component),c.propTypes={container:e.element.isRequired},c.prototype._createSWFElement=function(){var e=Object.assign({},this.props);return delete e.container,e.movie=e.src,e.ref=this._swfRefCallback,t.createElement(o,e)},c.prototype.getFPDOMNode=function(){return this._swf.getFPDOMNode()},c.prototype.componentDidMount=function(){var e=this._createSWFElement();this._container.innerHTML=r.renderToString(e),n.render(e,this._container)},c.prototype.componentDidUpdate=function(){var e=this._createSWFElement();n.render(e,this._container)},c.prototype.componentWillUnmount=function(){if(document.documentMode<9){var e=this.getFPDOMNode();for(var t in e)"function"==typeof e[t]&&(e[t]=null)}},c.prototype.render=function(){var e={ref:this._containerRefCallback};return t.cloneElement(this.props.container,e,null)},c});