UNPKG

pooliot-client

Version:
52 lines (33 loc) 1.47 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.update = undefined; var _nightingale = require('nightingale'); var _nightingale2 = _interopRequireDefault(_nightingale); var _params = require('../params'); var _exec = require('../utils/exec'); var _flowRuntime = require('flow-runtime'); var _flowRuntime2 = _interopRequireDefault(_flowRuntime); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const logger = new _nightingale2.default('app:commands:sound'); const set = output => { let _outputType = _flowRuntime2.default.union(_flowRuntime2.default.string('hdmi'), _flowRuntime2.default.string('jack')); _flowRuntime2.default.return(_flowRuntime2.default.void()); _flowRuntime2.default.param('output', _outputType).assert(output); logger.info('change sound output', { output }); (0, _exec.runSyncAsUser)('./sound.sh', [_params.board.sound.type, ..._params.board.sound[output]]); }; let currentSoundOutput; const update = exports.update = config => { let _configType = _flowRuntime2.default.object(); _flowRuntime2.default.param('config', _configType).assert(config); if (!config.sound || !_params.board.sound || !_params.board.sound[config.sound]) { currentSoundOutput = null; return; } if (currentSoundOutput === config.sound) return; currentSoundOutput = config.sound; set(currentSoundOutput); }; //# sourceMappingURL=sound.js.map