Skip to content

Commit

Permalink
Plugins param
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Sep 11, 2023
1 parent c50cbb4 commit 7464923
Show file tree
Hide file tree
Showing 4 changed files with 644 additions and 621 deletions.
2 changes: 1 addition & 1 deletion inst/htmlwidgets/JBrowseR.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@babel/preset-env": "^7.22.4",
"@babel/preset-react": "^7.22.3",
"babel-loader": "^9.1.2",
"prettier": "^3.0.3",
"webpack": "^5.85.0",
"webpack-cli": "^5.1.1"
}
Expand Down
39 changes: 30 additions & 9 deletions srcjs/components/JsonView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,38 @@ import { messageShiny } from '../utils'

export default function View(props) {
const configObject = JSON.parse(props.config)
const { assembly, tracks, defaultSession, theme, text_index } = configObject
const location = props.location
const state = createViewState({
const {
assembly,
tracks,
defaultSession,
location,
onChange: messageShiny,
configuration: { theme },
aggregateTextSearchAdapters: [text_index],
})
theme,
text_index,
plugins: pluginInput = [],
} = configObject
const location = props.location

const [viewState, setViewState] = useState()
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
;(async () => {
try {
const plugins = await loadPlugins(pluginInput)
const state = createViewState({
assembly,
tracks,
defaultSession,
location,
onChange: messageShiny,
configuration: { theme },
aggregateTextSearchAdapters: [text_index],
plugins: plugins.map(p => p.plugin),
})
setViewState(state)
} catch (e) {
setError(e)
}
})()
}, [])

return <JBrowseLinearGenomeView viewState={state} />
return <JBrowseLinearGenomeView viewState={viewState} />
}
Loading

0 comments on commit 7464923

Please sign in to comment.