@jbrowse/core
Version:
JBrowse 2 core libraries used by plugins
32 lines (31 loc) • 1.03 kB
JavaScript
import { getSnapshot, isStateTreeNode } from '@jbrowse/mobx-state-tree';
import { ConfigurationSchema, readConfObject, } from "../../configuration/index.js";
import idMaker from "../../util/idMaker.js";
const EmptyConfig = ConfigurationSchema('empty', {});
export class BaseAdapter {
config;
getSubAdapter;
pluginManager;
id;
sequenceAdapterConfig;
static capabilities = [];
constructor(config = EmptyConfig.create(), getSubAdapter, pluginManager) {
this.config = config;
this.getSubAdapter = getSubAdapter;
this.pluginManager = pluginManager;
if (typeof jest === 'undefined') {
const data = isStateTreeNode(config) ? getSnapshot(config) : config;
this.id = `${idMaker(data)}`;
}
else {
this.id = 'test';
}
}
setSequenceAdapterConfig(config) {
this.sequenceAdapterConfig = config;
}
getConf(arg) {
return readConfObject(this.config, arg);
}
freeResources(_region) { }
}