thebe-core
Version:
Typescript based core functionality for Thebe
49 lines • 2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Config = void 0;
const options_1 = require("./options");
const events_1 = require("./events");
class Config {
constructor(opts = {}, extraConfig) {
var _a, _b, _c, _d, _e, _f, _g;
this._events = (_a = extraConfig === null || extraConfig === void 0 ? void 0 : extraConfig.events) !== null && _a !== void 0 ? _a : new events_1.ThebeEvents();
this._options = {
mathjaxUrl: (_b = opts.mathjaxUrl) !== null && _b !== void 0 ? _b : 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js',
mathjaxConfig: (_c = opts.mathjaxConfig) !== null && _c !== void 0 ? _c : 'TeX-AMS_CHTML-full,Safe',
};
this._binderOptions = (0, options_1.makeBinderOptions)((_d = opts.binderOptions) !== null && _d !== void 0 ? _d : {});
this._savedSessions = (0, options_1.makeSavedSessionOptions)((_e = opts.savedSessionOptions) !== null && _e !== void 0 ? _e : {});
this._kernelOptions = (0, options_1.makeKernelOptions)((_f = opts.kernelOptions) !== null && _f !== void 0 ? _f : {});
this._serverSettings = (0, options_1.makeServerSettings)((_g = opts.serverSettings) !== null && _g !== void 0 ? _g : {});
console.debug('thebe:config:constructor', this);
}
get events() {
return this._events;
}
get base() {
return this._options;
}
get mathjax() {
return {
mathjaxUrl: this._options.mathjaxUrl,
mathjaxConfig: this._options.mathjaxConfig,
};
}
get binder() {
return this._binderOptions;
}
get savedSessions() {
return this._savedSessions;
}
get kernels() {
return this._kernelOptions;
}
get serverSettings() {
return this._serverSettings;
}
set serverSettings(newSettings) {
this._serverSettings = newSettings;
}
}
exports.Config = Config;
//# sourceMappingURL=config.js.map