diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-21 20:08:51 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-21 20:08:51 +0200 |
| commit | c2fc36f2e72340ab132a00de8d79a14211628cf4 (patch) | |
| tree | 2009f2e148e969f1f75ad241e32620acefb93baa /public/bundle.js | |
| parent | c9fdaf31a1f06862946bd7c13155c71015d5332c (diff) | |
statuses
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 149 |
1 files changed, 147 insertions, 2 deletions
diff --git a/public/bundle.js b/public/bundle.js index 4dfaeca..16b3832 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -71,6 +71,98 @@ /************************************************************************/ /******/ ({ +/***/ "./app/client/common/button.component.js": +/*!***********************************************!*\ + !*** ./app/client/common/button.component.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +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; }; }(); + +var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js"); + +var _reactRedux = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); + +var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"); + +var _actions = __webpack_require__(/*! ../live/actions */ "./app/client/live/actions.js"); + +var liveActions = _interopRequireWildcard(_actions); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +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 Button = function (_Component) { + _inherits(Button, _Component); + + function Button(props) { + _classCallCheck(this, Button); + + var _this = _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).call(this, props)); + + _this.handleClick = _this.handleClick.bind(_this); + return _this; + } + + _createClass(Button, [{ + key: 'handleClick', + value: function handleClick(e) { + this.props.onClick && this.props.onClick(); + } + }, { + key: 'render', + value: function render() { + return (0, _preact.h)( + 'div', + { className: 'button param' }, + (0, _preact.h)( + 'label', + null, + (0, _preact.h)( + 'span', + null, + this.props.title + ), + (0, _preact.h)( + 'button', + { + onClick: this.handleClick + }, + this.props.children + ) + ) + ); + } + }]); + + return Button; +}(_preact.Component); + +var mapStateToProps = function mapStateToProps(state) { + return {}; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { + return {}; +}; + +exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Button); + +/***/ }), + /***/ "./app/client/common/header.component.js": /*!***********************************************!*\ !*** ./app/client/common/header.component.js ***! @@ -581,7 +673,7 @@ var app = (0, _preact.h)( Object.defineProperty(exports, "__esModule", { value: true }); -exports.seek = exports.load_epoch = exports.load_sequence = exports.list_sequences = exports.list_epochs = exports.list_checkpoints = exports.set_param = exports.get_params = undefined; +exports.play = exports.pause = exports.seek = exports.load_epoch = exports.load_sequence = exports.list_sequences = exports.list_epochs = exports.list_checkpoints = exports.set_param = exports.get_params = undefined; var _socket = __webpack_require__(/*! ../socket */ "./app/client/socket.js"); @@ -630,6 +722,16 @@ var seek = exports.seek = function seek(frame) { return { type: 'SEEKING' }; }; +var pause = exports.pause = function pause(frame) { + socket.pause(pause); + return { type: 'PAUSING' }; +}; + +var play = exports.play = function play(frame) { + socket.play(); + return { type: 'PLAYING' }; +}; + /***/ }), /***/ "./app/client/live/components/player.component.js": @@ -708,6 +810,10 @@ var _select = __webpack_require__(/*! ../common/select.component */ "./app/clien var _select2 = _interopRequireDefault(_select); +var _button = __webpack_require__(/*! ../common/button.component */ "./app/client/common/button.component.js"); + +var _button2 = _interopRequireDefault(_button); + var _actions = __webpack_require__(/*! ./actions */ "./app/client/live/actions.js"); var liveActions = _interopRequireWildcard(_actions); @@ -737,6 +843,7 @@ var App = function (_Component) { _this.changeEpoch = _this.changeEpoch.bind(_this); _this.changeSequence = _this.changeSequence.bind(_this); _this.seek = _this.seek.bind(_this); + _this.toggle = _this.toggle.bind(_this); return _this; } @@ -770,6 +877,15 @@ var App = function (_Component) { this.props.actions.seek(frame); } }, { + key: 'toggle', + value: function toggle() { + if (this.props.opt.processing) { + this.props.actions.pause(); + } else { + this.props.actions.play(); + } + } + }, { key: 'render', value: function render() { return (0, _preact.h)( @@ -816,7 +932,18 @@ var App = function (_Component) { min: 0.0, max: 1.0, type: 'float', value: (this.props.frame.sequence_i || 0) / (this.props.frame.sequence_len || 1), onChange: this.seek - }) + }), + (0, _preact.h)( + 'div', + null, + 'Processing: ', + this.props.opt.processing + ), + (0, _preact.h)( + _button2.default, + { onClick: this.toggle }, + this.props.opt.processing ? 'Pause' : 'Restart' + ) ) ), (0, _preact.h)( @@ -1072,12 +1199,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.socket = undefined; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + exports.list_checkpoints = list_checkpoints; exports.list_epochs = list_epochs; exports.list_sequences = list_sequences; exports.load_epoch = load_epoch; exports.load_sequence = load_sequence; exports.seek = seek; +exports.pause = pause; +exports.play = play; exports.get_params = get_params; exports.set_param = set_param; @@ -1151,6 +1283,9 @@ socket.on('status', function (data) { console.log('got status', data.key, data.value); switch (data.key) { case 'processing': + _store.store.dispatch(_extends({ + type: 'SET_PARAM' + }, data)); break; default: break; @@ -1204,6 +1339,16 @@ function seek(frame) { payload: frame }); } +function pause(frame) { + socket.emit('cmd', { + cmd: 'pause' + }); +} +function play(frame) { + socket.emit('cmd', { + cmd: 'play' + }); +} function get_params() { socket.emit('cmd', { cmd: 'get_params' |
