skypager-project-types-electron-app
Version:
skypager electron app project type
1,265 lines (1,006 loc) • 35.4 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // identity function for calling harmory imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/ // define getter function for harmory exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ };
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 36);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./src/helpers/application.js":
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.attach = exports.Application = undefined;
var _toConsumableArray2 = __webpack_require__(13);
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _regenerator = __webpack_require__(4);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = __webpack_require__(9);
var _promise2 = _interopRequireDefault(_promise);
var _asyncToGenerator2 = __webpack_require__(3);
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _extends2 = __webpack_require__(11);
var _extends3 = _interopRequireDefault(_extends2);
var _getPrototypeOf = __webpack_require__(5);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(1);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(2);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(7);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(6);
var _inherits3 = _interopRequireDefault(_inherits2);
var _skypagerHelper = __webpack_require__(8);
var _skypagerHelper2 = _interopRequireDefault(_skypagerHelper);
var _electron = __webpack_require__(0);
var _path = __webpack_require__(10);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Application = exports.Application = function (_Helper) {
(0, _inherits3.default)(Application, _Helper);
function Application() {
(0, _classCallCheck3.default)(this, Application);
return (0, _possibleConstructorReturn3.default)(this, (Application.__proto__ || (0, _getPrototypeOf2.default)(Application)).apply(this, arguments));
}
(0, _createClass3.default)(Application, [{
key: 'info',
value: function info() {
var _project;
return (_project = this.project).info.apply(_project, arguments);
}
}, {
key: 'debug',
value: function debug() {
var _project2;
return (_project2 = this.project).debug.apply(_project2, arguments);
}
}, {
key: 'error',
value: function error() {
var _project3;
return (_project3 = this.project).error.apply(_project3, arguments);
}
}, {
key: 'initialize',
value: function initialize() {
var _this2 = this;
this.applyMixin(this.provider, this.context, this);
this.lazy('defaultPanelOptions', function () {
return _this2.tryResult('panelDefaults', {});
});
this.debug('Initializing Application with Panel Options', {
panelOptions: this.defaultPanelOptions
});
if (this.tryResult('launchImmediately') !== false) {
if (_electron.app.isReady()) {
this.debug('App is already ready. Launching.');
this.launch().then(function () {
_this2.isLaunched = true;
_this2.isLaunching = false;
}).catch(function (error) {
_this2.isLaunched = true;
_this2.isLaunching = false;
_this2.launchError = error;
});
} else {
_electron.app.once('ready', function () {
return _this2.launch().then(function () {
return _this2.isLaunched = true;
}).catch(function (error) {
_this2.debug('App became ready. Launching.');
_this2.isLaunched = true;
_this2.isLaunching = false;
_this2.launchError = error;
});
});
}
}
_electron.app.on('before-quit', this._beforeQuit.bind(this));
_electron.app.on('will-quit', this._willQuit.bind(this));
_electron.app.on('quit', this._onQuit.bind(this));
this.lazy('storage', function () {
_this2.debug('Initializing storage');
return __webpack_require__("./src/runtime/storage.js");
});
this.hide('activePanels', {});
/*
protocol.registerBufferProtocol('skypager', (request, callback) => {
const { url, uploadData, method = 'GET', referrer = '' } = request
callback({
mimeType: 'text/html',
data: new Buffer(`Hi`)
})
})
*/
}
}, {
key: '_willQuit',
value: function _willQuit(event) {
this.debug('App is quitting', event);
if (this.appIsQuitting) {
this.appIsQuitting(event);
}
}
}, {
key: '_beforeQuit',
value: function _beforeQuit(event) {
this.debug('App will quit', event);
if (this.appWillQuit) {
this.appWillQuit(event);
}
}
}, {
key: 'getPath',
value: function getPath() {
return _electron.app.getPath.apply(_electron.app, arguments);
}
}, {
key: 'setApplicationMenu',
value: function setApplicationMenu() {
var _Menu;
return (_Menu = this.Menu).setApplicationMenu.apply(_Menu, arguments);
}
}, {
key: 'setAboutPanel',
value: function setAboutPanel() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return this.app.setAboutPanelOptions((0, _extends3.default)({
applicationName: this.tryResult('appName', this.project.getEither('manifest.productName', 'manifest.appName', 'manifest.name')),
applicationVersion: this.tryResult('appVersion', this.project.getEither('manifest.appVersion', 'manifest.version'))
}, options));
}
}, {
key: 'open',
value: function () {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var result;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return new _promise2.default(function (resolve, reject) {
_electron.dialog.showOpenDialog(options, function (files) {
resolve({ files: files, options: options });
});
});
case 2:
result = _context.sent;
if (!this.userOpenedFiles) {
_context.next = 6;
break;
}
_context.next = 6;
return this.userOpenedFiles(result);
case 6:
return _context.abrupt('return', result);
case 7:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
function open() {
return _ref.apply(this, arguments);
}
return open;
}()
}, {
key: 'save',
value: function () {
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var result;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return new _promise2.default(function (resolve, reject) {
_electron.dialog.showSaveDialog(options, function (file) {
resolve({ file: file, options: options });
});
});
case 2:
result = _context2.sent;
if (!this.userSavedFiles) {
_context2.next = 6;
break;
}
_context2.next = 6;
return this.userSavedFiles(result);
case 6:
return _context2.abrupt('return', result);
case 7:
case 'end':
return _context2.stop();
}
}
}, _callee2, this);
}));
function save() {
return _ref2.apply(this, arguments);
}
return save;
}()
}, {
key: 'findPanelForWindow',
value: function findPanelForWindow(windowId) {
var browserWindow = this.get('browserWindows').find(function (b) {
return b.windowId === windowId;
});
if (browserWindow) {
return browserWindow.getPanel();
}
}
}, {
key: 'askPanel',
value: function () {
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(id, payload) {
var _panel;
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
var response;
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
response = (_panel = this.panel(id)).askPanel.apply(_panel, [payload].concat((0, _toConsumableArray3.default)(args)));
return _context3.abrupt('return', response);
case 2:
case 'end':
return _context3.stop();
}
}
}, _callee3, this);
}));
function askPanel(_x4, _x5) {
return _ref3.apply(this, arguments);
}
return askPanel;
}()
}, {
key: 'tellPanel',
value: function () {
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(id, payload) {
var _panel2;
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
var response;
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
response = (_panel2 = this.panel(id)).tellPanel.apply(_panel2, [payload].concat((0, _toConsumableArray3.default)(args)));
return _context4.abrupt('return', response);
case 2:
case 'end':
return _context4.stop();
}
}
}, _callee4, this);
}));
function tellPanel(_x6, _x7) {
return _ref4.apply(this, arguments);
}
return tellPanel;
}()
}, {
key: 'panel',
value: function panel(id) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instanceId = options.instanceId || id;
if (!options.fresh && this.get(['activePanels', instanceId])) {
return this.get(['activePanels', instanceId]);
}
var object = this.project.panel(id, (0, _extends3.default)({}, this.get('defaultPanelOptions', {}), this.get('panelOptions.' + id, {}), {
cacheHelper: !options.fresh
}, options), {
appInstance: this
});
this.set(['activePanels', instanceId], object);
return object;
}
}, {
key: 'launch',
value: function () {
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5() {
return _regenerator2.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
this.debug('App launch');
if (!this.isSecondInstance) {
_context5.next = 13;
break;
}
this.debug('App launched as second instance');
if (!this.applicationIsDuplicate) {
_context5.next = 13;
break;
}
this.debug('applicationIsDuplicate hook being called');
_context5.prev = 5;
_context5.next = 8;
return this.applicationIsDuplicate();
case 8:
_context5.next = 13;
break;
case 10:
_context5.prev = 10;
_context5.t0 = _context5['catch'](5);
this.app.quit(0);
case 13:
if (!this.isLaunched) {
_context5.next = 16;
break;
}
this.isLaunching = false;
return _context5.abrupt('return', this);
case 16:
this.isLaunching = true;
this.debug('prepareSystem');
_context5.prev = 18;
_context5.next = 21;
return this.prepareSystem();
case 21:
_context5.next = 26;
break;
case 23:
_context5.prev = 23;
_context5.t1 = _context5['catch'](18);
this.error('Error in prepareSystem', _context5.t1);
case 26:
this.debug('prepareApplication');
if (!this.prepareApplication) {
_context5.next = 37;
break;
}
_context5.prev = 28;
_context5.next = 31;
return this.prepareApplication();
case 31:
this.debug('prepareApplication custom hook was called');
_context5.next = 37;
break;
case 34:
_context5.prev = 34;
_context5.t2 = _context5['catch'](28);
this.error('prepareApplication Error', _context5.t2);
case 37:
this.debug('applicationWillLaunch');
if (!this.applicationWillLaunch) {
_context5.next = 48;
break;
}
_context5.prev = 39;
_context5.next = 42;
return this.applicationWillLaunch();
case 42:
this.debug('applicationWillLaunch custom hook was called');
_context5.next = 48;
break;
case 45:
_context5.prev = 45;
_context5.t3 = _context5['catch'](39);
this.error('applicationWillLaunch', _context5.t3);
case 48:
if (this.prepareTray) {
try {
this.debug('prepareTray');
this.prepareTray();
} catch (error) {
this.error('prepareTray Error', error);
}
}
if (!this.applicationDidLaunch) {
_context5.next = 59;
break;
}
_context5.prev = 50;
_context5.next = 53;
return this.applicationDidLaunch();
case 53:
this.debug('applicationDidLaunch custom hook was called');
_context5.next = 59;
break;
case 56:
_context5.prev = 56;
_context5.t4 = _context5['catch'](50);
this.error('applicationDidLaunch Error', _context5.t4);
case 59:
this.isLaunching = false;
return _context5.abrupt('return', this);
case 61:
case 'end':
return _context5.stop();
}
}
}, _callee5, this, [[5, 10], [18, 23], [28, 34], [39, 45], [50, 56]]);
}));
function launch() {
return _ref5.apply(this, arguments);
}
return launch;
}()
}, {
key: 'receivePanelMessage',
value: function () {
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6() {
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
channel = _ref7.channel,
panel = _ref7.panel,
payload = _ref7.payload;
return _regenerator2.default.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
if (!this.handlePanelMessage) {
_context6.next = 2;
break;
}
return _context6.abrupt('return', this.handlePanelMessage({ channel: channel, panel: panel, payload: payload }).then(function (r) {
return r;
}));
case 2:
return _context6.abrupt('return', payload);
case 3:
case 'end':
return _context6.stop();
}
}
}, _callee6, this);
}));
function receivePanelMessage() {
return _ref6.apply(this, arguments);
}
return receivePanelMessage;
}()
}, {
key: 'prepareSystem',
value: function () {
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7() {
return _regenerator2.default.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return this.prepareStorage();
case 2:
_context7.next = 4;
return this.prepareLogging();
case 4:
case 'end':
return _context7.stop();
}
}
}, _callee7, this);
}));
function prepareSystem() {
return _ref8.apply(this, arguments);
}
return prepareSystem;
}()
}, {
key: 'prepareLogging',
value: function () {
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8() {
return _regenerator2.default.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
case 'end':
return _context8.stop();
}
}
}, _callee8, this);
}));
function prepareLogging() {
return _ref9.apply(this, arguments);
}
return prepareLogging;
}()
}, {
key: 'prepareStorage',
value: function () {
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9() {
return _regenerator2.default.wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
_context9.next = 2;
return this.project.mkdirpAsync(this.storagePath);
case 2:
case 'end':
return _context9.stop();
}
}
}, _callee9, this);
}));
function prepareStorage() {
return _ref10.apply(this, arguments);
}
return prepareStorage;
}()
}, {
key: 'createTray',
value: function createTray(trayIcon) {
return new _electron.Tray(trayIcon);
}
/**
* Returns true if the application can only be a single instance
*/
}, {
key: '_secondInstance',
value: function _secondInstance() {
if (this.secondInstanceWasLaunched) {
return this.secondInstanceWasLaunched.apply(this, arguments);
}
}
}, {
key: '_onQuit',
value: function _onQuit() {
if (this.appDidQuit) {
return this.appDidQuit.apply(this, arguments);
}
}
}, {
key: 'appPath',
get: function get() {
return this.get('options.appPath', this.get('project.paths.output', _electron.app.getAppPath()));
}
}, {
key: 'dock',
get: function get() {
return this.get('app.dock', _electron.app.dock);
}
}, {
key: 'tmpdir',
get: function get() {
return this.getPath('temp');
}
}, {
key: 'storagePath',
get: function get() {
return (0, _path.join)(this.userDataPath, 'storage');
}
}, {
key: 'userDataPath',
get: function get() {
return this.getPath('userData');
}
}, {
key: 'userHomePath',
get: function get() {
return this.getPath('home');
}
}, {
key: 'panelOptions',
get: function get() {
return this.tryGet('panels', {});
}
}, {
key: 'app',
get: function get() {
return _electron.app;
}
}, {
key: 'browserWindows',
get: function get() {
return this.BrowserWindow.getAllWindows();
}
}, {
key: 'BrowserWindow',
get: function get() {
return this.tryGet('BrowserWindow', _electron.BrowserWindow);
}
}, {
key: 'Menu',
get: function get() {
return this.tryGet('Menu', _electron.Menu);
}
}, {
key: 'dialog',
get: function get() {
return this.tryGet('dialog', _electron.dialog);
}
}, {
key: 'protocol',
get: function get() {
return this.tryGet('protocol', _electron.protocol);
}
}, {
key: 'Tray',
get: function get() {
return this.tryGet('Tray', _electron.Tray);
}
}, {
key: 'ipcStream',
get: function get() {
return this.tryGet('ipcStream', __webpack_require__("./src/helpers/stream.js"));
}
}, {
key: 'isSecondInstance',
get: function get() {
var _this3 = this;
return _electron.app.makeSingleInstance(function (commandLine, workingDirectory) {
_this3._secondInstance(commandLine, workingDirectory);
});
}
}, {
key: 'singleInstance',
get: function get() {
return this.tryGet('singleInstance', false);
}
}], [{
key: 'attach',
value: function attach(project) {
return _skypagerHelper2.default.attach(project, Application, {
registryProp: 'applications',
lookupProp: 'application',
registry: _skypagerHelper2.default.createContextRegistry('applications', {
context: __webpack_require__(15),
dirname: __dirname,
filename: __filename
})
});
}
}]);
return Application;
}(_skypagerHelper2.default); /**
* @method appWillQuit
* @method appIsQuitting
* @method appIsDuplicate
* @method prepareApplication
* @method applicationWillLaunch
* @method applicationDidLaunch
* @method handlePanelMessage
* @method secondInstanceWasLaunched
* @method appDidQuit
* @method prepareTray
* @method userOpenedFiles
* @method userSavedFiles
*/
exports.default = Application;
var attach = exports.attach = Application.attach;
/***/ },
/***/ "./src/helpers/applications/project.js":
/***/ function(module, exports, __webpack_require__) {
"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.applicationWillLaunch = exports.handlePanelMessage = exports.applicationDidLaunch = exports.applicationIsReady = exports.prepareApplication = undefined;
var _regenerator = __webpack_require__(4);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = __webpack_require__(3);
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var prepareApplication = exports.prepareApplication = function () {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return function prepareApplication() {
return _ref.apply(this, arguments);
};
}();
var applicationIsReady = exports.applicationIsReady = function () {
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2() {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", this);
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
return function applicationIsReady() {
return _ref2.apply(this, arguments);
};
}();
var applicationDidLaunch = exports.applicationDidLaunch = function () {
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
return function applicationDidLaunch() {
return _ref3.apply(this, arguments);
};
}();
var handlePanelMessage = exports.handlePanelMessage = function () {
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4() {
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
channel = _ref5.channel,
payload = _ref5.payload,
panel = _ref5.panel;
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
return _context4.abrupt("return", payload);
case 1:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
return function handlePanelMessage() {
return _ref4.apply(this, arguments);
};
}();
var applicationWillLaunch = exports.applicationWillLaunch = function () {
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _regenerator2.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
return function applicationWillLaunch() {
return _ref6.apply(this, arguments);
};
}();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ },
/***/ "./src/helpers/stream.js":
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
var _stringify = __webpack_require__(12);
var _stringify2 = _interopRequireDefault(_stringify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var bufferJson = __webpack_require__(24);
var Duplex = __webpack_require__(32).Duplex;
var ipcMain = __webpack_require__(0).ipcMain;
var util = __webpack_require__(34);
function MainIPCStream(channel, browserWindow, streamOpts) {
var _this = this;
if (!(this instanceof MainIPCStream)) {
return new MainIPCStream(channel, browserWindow, streamOpts);
}
streamOpts = streamOpts || {};
streamOpts.objectMode = streamOpts.objectMode ? streamOpts.objectMode : true;
this.browserWindow = browserWindow;
this.channel = channel;
var ipcCallback = function ipcCallback(event, data) {
if (typeof data === 'string') {
data = JSON.parse(data, bufferJson.reviver);
}
_this.push(data);
};
ipcMain.on(this.channel, ipcCallback);
this.on('finish', function () {
if (_this.browserWindow) _this.browserWindow.webContents.send(_this.channel + '-finish');
ipcMain.removeListener(_this.channel, ipcCallback);
});
ipcMain.once(this.channel + '-finish', function () {
return _this.push(null);
});
Duplex.call(this, streamOpts);
}
util.inherits(MainIPCStream, Duplex);
MainIPCStream.prototype._read = function () {};
MainIPCStream.prototype._write = function (data, enc, next) {
if (typeof data === 'string') {
data = (0, _stringify2.default)(data);
}
if (Buffer.isBuffer(data)) {
data = (0, _stringify2.default)(data, null, bufferJson.replacer);
}
if (!this.browserWindow) return console.warn('MainIPCStream: trying to write when no browserWindow is set.');
this.browserWindow.webContents.send(this.channel, data);
next();
};
module.exports = MainIPCStream;
/***/ },
/***/ "./src/runtime/storage.js":
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
var Promise = __webpack_require__(23);
var promisified = Promise.promisifyAll(__webpack_require__(26));
module.exports = {
get: function get() {
return promisified.getAsync.apply(promisified, arguments);
},
set: function set() {
return promisified.setAsync.apply(promisified, arguments);
},
keys: function keys() {
return promisified.keysAsync.apply(promisified, arguments);
},
has: function has() {
return promisified.hasAsync.apply(promisified, arguments);
},
clear: function clear() {
return promisified.clearAsync.apply(promisified, arguments);
},
remove: function remove() {
return promisified.removeAsync.apply(promisified, arguments);
}
};
/***/ },
/***/ 0:
/***/ function(module, exports) {
module.exports = require("electron");
/***/ },
/***/ 1:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/classCallCheck");
/***/ },
/***/ 10:
/***/ function(module, exports) {
module.exports = require("path");
/***/ },
/***/ 11:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/extends");
/***/ },
/***/ 12:
/***/ function(module, exports) {
module.exports = require("babel-runtime/core-js/json/stringify");
/***/ },
/***/ 13:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/toConsumableArray");
/***/ },
/***/ 15:
/***/ function(module, exports, __webpack_require__) {
var map = {
"./project.js": "./src/helpers/applications/project.js"
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
var id = map[req];
if(!(id + 1)) // check for number
throw new Error("Cannot find module '" + req + "'.");
return id;
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 15;
/***/ },
/***/ 2:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/createClass");
/***/ },
/***/ 23:
/***/ function(module, exports) {
module.exports = require("bluebird");
/***/ },
/***/ 24:
/***/ function(module, exports) {
module.exports = require("buffer-json");
/***/ },
/***/ 26:
/***/ function(module, exports) {
module.exports = require("electron-json-storage");
/***/ },
/***/ 3:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/asyncToGenerator");
/***/ },
/***/ 32:
/***/ function(module, exports) {
module.exports = require("stream");
/***/ },
/***/ 34:
/***/ function(module, exports) {
module.exports = require("util");
/***/ },
/***/ 36:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__("./src/helpers/application.js");
/***/ },
/***/ 4:
/***/ function(module, exports) {
module.exports = require("babel-runtime/regenerator");
/***/ },
/***/ 5:
/***/ function(module, exports) {
module.exports = require("babel-runtime/core-js/object/get-prototype-of");
/***/ },
/***/ 6:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/inherits");
/***/ },
/***/ 7:
/***/ function(module, exports) {
module.exports = require("babel-runtime/helpers/possibleConstructorReturn");
/***/ },
/***/ 8:
/***/ function(module, exports) {
module.exports = require("skypager-helper");
/***/ },
/***/ 9:
/***/ function(module, exports) {
module.exports = require("babel-runtime/core-js/promise");
/***/ }
/******/ });