Made eslint using 'browser' environment and added globals, because RainLoop is used in browsers.

This also allowed to remove all webpack 'externals' overhead.
This commit is contained in:
djmaze 2020-08-12 00:25:36 +02:00
parent c3a213802d
commit e7180a86ce
81 changed files with 1857 additions and 1259 deletions

View file

@ -1,6 +1,3 @@
import crossroads from 'crossroads';
import { isNonEmptyArray } from 'Common/Utils';
export class AbstractScreen {
oCross = null;
sScreenName;
@ -47,9 +44,9 @@ export class AbstractScreen {
fMatcher = null;
const routes = this.routes();
if (isNonEmptyArray(routes)) {
if (Array.isArray(routes) && routes.length) {
fMatcher = (this.onRoute || (()=>{})).bind(this);
route = crossroads.create();
route = new Crossroads();
routes.forEach((item) => {
if (item && route) {

View file

@ -1,5 +1,4 @@
import ko from 'ko';
import window from 'window';
import { delegateRun, inFocus } from 'Common/Utils';
import { KeyState, EventKeyCode } from 'Common/Enums';
@ -36,7 +35,7 @@ export class AbstractViewNext {
* @returns {void}
*/
registerPopupKeyDown() {
window.addEventListener('keydown', (event) => {
addEventListener('keydown', (event) => {
if (event && this.modalVisibility && this.modalVisibility()) {
if (!this.bDisabeCloseOnEsc && EventKeyCode.Esc === event.keyCode) {
delegateRun(this, 'cancelCommand');

View file

@ -1,18 +1,15 @@
import $ from '$';
import ko from 'ko';
import hasher from 'hasher';
import crossroads from 'crossroads';
import { Magics } from 'Common/Enums';
import { runHook } from 'Common/Plugins';
import { $htmlCL, VIEW_MODELS, popupVisibilityNames } from 'Common/Globals';
import { pString, log, createCommandLegacy, delegateRun, isNonEmptyArray } from 'Common/Utils';
import { pString, createCommandLegacy, delegateRun, isNonEmptyArray } from 'Common/Utils';
let currentScreen = null,
defaultScreenName = '';
const SCREENS = {};
const SCREENS = {}, $ = jQuery;
export const ViewType = {
Popup: 'Popups',
@ -224,7 +221,7 @@ export function buildViewModel(ViewModelClass, vmScreen) {
vmRunHook('view-model-post-build', ViewModelClass, vmDom);
} else {
log('Cannot find view model position: ' + position);
console.log('Cannot find view model position: ' + position);
}
}
@ -424,7 +421,7 @@ export function startScreens(screensClasses) {
}
});
const cross = crossroads.create();
const cross = new Crossroads();
cross.addRoute(/^([a-zA-Z0-9-]*)\/?(.*)$/, screenOnRoute);
hasher.initialized.add(cross.parse, cross);