3

I'm trying to add a script tag to the body of index.html in JBrowse 11.5. I want it to be executed after everything has loaded. All the CSS, asynchronously loaded tracks and so on. I've tried domReady! and dom/ready but they are triggered too early. Does anyone know how to add a script after all has loaded?

es1
  • 1,231
  • 3
  • 14
  • 27

1 Answers1

0

It might depend on what you mean by "everything being loaded", but you could try a couple different methods.

For example, in index.html you might write something like this

JBrowse.afterMilestone('initView', function() {
    // add your code to inject script here
})

You can just add arbitrary javascript there, include new AMD modules, or use some other code injection type method e.g. inject a script tag with remote src and wait for it to execute

Alternatively, check out the plugin architecture for JBrowse, it is also a good way to include new code modules

Community
  • 1
  • 1
Colin D
  • 2,822
  • 1
  • 31
  • 38