mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[Example] Add new example bundle
Add an example bundle containing custom extensions, which can be recognized by extensions from another bundle. WTD-518.
This commit is contained in:
parent
033ecec295
commit
aeb670bf5f
@ -27,11 +27,6 @@
|
||||
"key": "exampleService",
|
||||
"implementation": "ExampleService.js"
|
||||
}
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"text": "This is an example from example/builtins."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -8,6 +8,10 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var HAS_EXTENSIONS = "A directive loaded these example extensions.",
|
||||
NO_EXTENSIONS = "A directive tried to load example extensions," +
|
||||
" but found none.";
|
||||
|
||||
/**
|
||||
*
|
||||
* @constructor
|
||||
@ -15,9 +19,9 @@ define(
|
||||
function ExampleDirective(examples) {
|
||||
// Build up a template from example extensions
|
||||
var template = examples.length > 0 ?
|
||||
"A directive loaded these example extensions:<ul>" :
|
||||
"This came from a directive.<ul>";
|
||||
HAS_EXTENSIONS : NO_EXTENSIONS;
|
||||
|
||||
template += "<ul>"
|
||||
examples.forEach(function (e) {
|
||||
template += "<li>" + e.text + "</li>";
|
||||
});
|
||||
|
12
example/extensions/bundle.json
Normal file
12
example/extensions/bundle.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Custom Extensions Examples",
|
||||
"description": "Example showing how to declare custom extensions.",
|
||||
"sources": "src",
|
||||
"extensions": {
|
||||
"examples": [
|
||||
{
|
||||
"text": "I came from example/extensions"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user