alm
Version:
The best IDE for TypeScript
42 lines (41 loc) • 1.87 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var Modal = require("react-modal");
var ui = require("../ui");
var csx = require("../base/csx");
var socketClient_1 = require("../../socket/socketClient");
var ServerExit = /** @class */ (function (_super) {
__extends(ServerExit, _super);
function ServerExit(props) {
var _this = _super.call(this, props) || this;
_this.askUserToClose = function () { return ui.notifyInfoQuickDisappear("Please close the browser tab manually"); };
_this.state = {
isOpen: false
};
return _this;
}
ServerExit.prototype.componentDidMount = function () {
var _this = this;
socketClient_1.cast.serverExiting.on(function () {
_this.setState({ isOpen: true });
document.title = "Server Exited 🌹";
});
};
ServerExit.prototype.render = function () {
return (React.createElement(Modal, { isOpen: this.state.isOpen, onRequestClose: this.askUserToClose },
React.createElement("div", { style: csx.extend(csx.centerCenter, csx.flex, { color: 'white', fontSize: '20px' }), onClick: this.askUserToClose }, "The server has exited. Please close this browser tab.")));
};
return ServerExit;
}(ui.BaseComponent));
exports.ServerExit = ServerExit;