UNPKG

armo-breadboard

Version:

Edit a live React component's source in real time.

50 lines (37 loc) 2.2 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _class, _temp2, _initialiseProps; var _reactControllers = require('react-controllers'); 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 ConsoleController = (_temp2 = _class = function (_Controller) { _inherits(ConsoleController, _Controller); function ConsoleController() { var _ref; var _temp, _this, _ret; _classCallCheck(this, ConsoleController); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ConsoleController.__proto__ || Object.getPrototypeOf(ConsoleController)).call.apply(_ref, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), _possibleConstructorReturn(_this, _ret); } return ConsoleController; }(_reactControllers.Controller), _class.actions = { log: function log(level, file, args) { this.setState({ messages: this.state.messages.concat({ level: level, file: file, args: args }) }); }, clear: function clear() { this.setState({ messages: [] }); } }, _initialiseProps = function _initialiseProps() { this.state = { messages: [] }; }, _temp2); exports.default = ConsoleController;