Fix error on keypress
Uncaught TypeError: Cannot assign to read only property 'ignoreNextKeypress' of object '[object Object]' at ../node_modules/combokeys/Combokeys/index.js.module.exports.../node_modules/combokeys/Combokeys/prototype/handleKey.js.module.exports [as handleKey] (/Users/Samuel/Documents/BetterDiscord/2018-01-19/betterdiscordapp/client/dist/betterdiscord.client.…:4703) at ../node_modules/combokeys/Combokeys/index.js.module.exports.../node_modules/combokeys/Combokeys/prototype/handleKeyEvent.js.module.exports (/Users/Samuel/Documents/BetterDiscord/2018-01-19/betterdiscordapp/client/dist/betterdiscord.client.…:4752) at HTMLDocument.r (721226c….js:25)
This commit is contained in:
parent
3578698a86
commit
b24e0ef178
|
@ -10,15 +10,16 @@
|
||||||
|
|
||||||
import Content from './content';
|
import Content from './content';
|
||||||
import Globals from './globals';
|
import Globals from './globals';
|
||||||
|
import Database from './database';
|
||||||
import { Utils, FileUtils, ClientLogger as Logger } from 'common';
|
import { Utils, FileUtils, ClientLogger as Logger } from 'common';
|
||||||
import path from 'path';
|
|
||||||
import { Events } from 'modules';
|
import { Events } from 'modules';
|
||||||
import { SettingsSet, ErrorEvent } from 'structs';
|
import { SettingsSet, ErrorEvent } from 'structs';
|
||||||
import { Modals } from 'ui';
|
import { Modals } from 'ui';
|
||||||
import Database from './database';
|
import path from 'path';
|
||||||
|
import Combokeys from 'combokeys';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for external content managing
|
* Base class for managing external content
|
||||||
*/
|
*/
|
||||||
export default class {
|
export default class {
|
||||||
|
|
||||||
|
@ -209,10 +210,12 @@ export default class {
|
||||||
userConfig.config.setSaved();
|
userConfig.config.setSaved();
|
||||||
|
|
||||||
for (let setting of userConfig.config.findSettings(() => true)) {
|
for (let setting of userConfig.config.findSettings(() => true)) {
|
||||||
|
// This will load custom settings
|
||||||
|
// Setting the content's path on only the live config (and not the default config) ensures that custom settings will not be loaded on the default settings
|
||||||
setting.setContentPath(contentPath);
|
setting.setContentPath(contentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.deepfreeze(defaultConfig);
|
Utils.deepfreeze(defaultConfig, object => object instanceof Combokeys);
|
||||||
|
|
||||||
const configs = {
|
const configs = {
|
||||||
defaultConfig,
|
defaultConfig,
|
||||||
|
|
|
@ -146,12 +146,14 @@ export class Utils {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static deepfreeze(object) {
|
static deepfreeze(object, exclude) {
|
||||||
|
if (exclude && exclude(object)) return;
|
||||||
|
|
||||||
if (typeof object === 'object' && object !== null) {
|
if (typeof object === 'object' && object !== null) {
|
||||||
const properties = Object.getOwnPropertyNames(object);
|
const properties = Object.getOwnPropertyNames(object);
|
||||||
|
|
||||||
for (let property of properties) {
|
for (let property of properties) {
|
||||||
this.deepfreeze(object[property]);
|
this.deepfreeze(object[property], exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.freeze(object);
|
Object.freeze(object);
|
||||||
|
|
Loading…
Reference in New Issue