Skip to content

Commit

Permalink
[update docs] Fix syntax error in plugin docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 27, 2023
1 parent f4d921e commit 05e1776
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 163 deletions.
2 changes: 1 addition & 1 deletion website/docs/config_guides/customizing_feature_colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For example, create a file named "myplugin.js" (see also Footnote 1)
// the plugin will be included in both the main thread and web worker, so
// install plugin to either window or self (webworker global scope)
;(typeof self !== 'undefined' ? self : window).JBrowsePluginMyPlugin = {
default: Plugin,
default: MyPlugin,
}
})()
```
Expand Down
32 changes: 23 additions & 9 deletions website/docs/config_guides/customizing_feature_details.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ You can make a small plugin file "myplugin.js"
// the plugin will be included in both the main thread and web worker, so
// install plugin to either window or self (webworker global scope)
;(typeof self !== 'undefined' ? self : window).JBrowsePluginMyPlugin = {
default: Plugin,
default: MyPlugin,
}
})()
```
Expand Down Expand Up @@ -155,31 +155,45 @@ of your data file, you could make a jexl function such as the following
// the plugin will be included in both the main thread and web worker, so
// install plugin to either window or self (webworker global scope)
;(typeof self !== 'undefined' ? self : window).JBrowsePluginMyPlugin = {
default: Plugin,
default: MyPlugin,
}
})()
```

And then in your config
And then in your config.json

```json
{
...
"formatDetails": {
"feature": "jexl:{dbxref:linkout(feature)}",
"subfeatures": "jexl:{dbxref:linkout(feature)}"
}
"plugins": [
{
"name": "MyPlugin",
"umdLoc": { "uri": "myplugin.js" }
}
],
"tracks": [
{
"trackId": "mytrack",
"name":"My track",
"adapter": {...},
"formatDetails": {
"feature": "jexl:{dbxref:linkout(feature)}",
"subfeatures": "jexl:{dbxref:linkout(feature)}"
}
}
]
}
```

#### Footnote 1
#### Footnote 1 - the feature details are serialized to plain JSON objects

Note that the feature for feature detail panels is different from that in the
color callback: it is a plain JS object. So instead of `feature.get('start')`,
you can say just `feature.start`. The reason it is different for the feature
details callbacks (compared with e.g. the color callbacks) is that the feature
is serialized into the session.

#### Footnote 2 - why are feature details plain JSON objects when other usages aren't?

You might also ask why aren't all features serialized or plain JSON objects
normally? Well, some feature types like alignments features benefit from only
being partially serialized e.g. getting only a couple attributes via
Expand Down
Loading

0 comments on commit 05e1776

Please sign in to comment.