Last active
November 10, 2017 20:09
-
-
Save davidbalbert/44f7f3329c2bcbc5b5bee2d4b93a8253 to your computer and use it in GitHub Desktop.
Support for running RC Scout with React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RCScout extends React.Component { | |
rerenderScout() { | |
if (window._rcs && window._rcs.inst) { | |
window._rcs.inst.render(); | |
} | |
} | |
componentDidMount() { | |
this.rerenderScout(); | |
} | |
componentDidUpdate() { | |
this.rerenderScout(); | |
} | |
render() { | |
return <div className="rc-scout" />; | |
} | |
} | |
window.RCScout = RCScout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
var RCScout = function (_React$Component) { | |
_inherits(RCScout, _React$Component); | |
function RCScout() { | |
_classCallCheck(this, RCScout); | |
return _possibleConstructorReturn(this, (RCScout.__proto__ || Object.getPrototypeOf(RCScout)).apply(this, arguments)); | |
} | |
_createClass(RCScout, [{ | |
key: "rerenderScout", | |
value: function rerenderScout() { | |
if (window._rcs && window._rcs.inst) { | |
window._rcs.inst.render(); | |
} | |
} | |
}, { | |
key: "componentDidMount", | |
value: function componentDidMount() { | |
this.rerenderScout(); | |
} | |
}, { | |
key: "componentDidUpdate", | |
value: function componentDidUpdate() { | |
this.rerenderScout(); | |
} | |
}, { | |
key: "render", | |
value: function render() { | |
return React.createElement("div", { className: "rc-scout" }); | |
} | |
}]); | |
return RCScout; | |
}(React.Component); | |
window.RCScout = RCScout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict";var _createClass=function(){function a(b,c){for(var e,d=0;d<c.length;d++)e=c[d],e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(b,e.key,e)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&("object"==typeof b||"function"==typeof b)?b:a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var RCScout=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"rerenderScout",value:function rerenderScout(){window._rcs&&window._rcs.inst&&window._rcs.inst.render()}},{key:"componentDidMount",value:function componentDidMount(){this.rerenderScout()}},{key:"componentDidUpdate",value:function componentDidUpdate(){this.rerenderScout()}},{key:"render",value:function render(){return React.createElement("div",{className:"rc-scout"})}}]),b}(React.Component);window.RCScout=RCScout; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment