mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 21:58:13 +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:
@ -27,11 +27,6 @@
|
|||||||
"key": "exampleService",
|
"key": "exampleService",
|
||||||
"implementation": "ExampleService.js"
|
"implementation": "ExampleService.js"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"examples": [
|
|
||||||
{
|
|
||||||
"text": "This is an example from example/builtins."
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,10 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var HAS_EXTENSIONS = "A directive loaded these example extensions.",
|
||||||
|
NO_EXTENSIONS = "A directive tried to load example extensions," +
|
||||||
|
" but found none.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
@ -15,9 +19,9 @@ define(
|
|||||||
function ExampleDirective(examples) {
|
function ExampleDirective(examples) {
|
||||||
// Build up a template from example extensions
|
// Build up a template from example extensions
|
||||||
var template = examples.length > 0 ?
|
var template = examples.length > 0 ?
|
||||||
"A directive loaded these example extensions:<ul>" :
|
HAS_EXTENSIONS : NO_EXTENSIONS;
|
||||||
"This came from a directive.<ul>";
|
|
||||||
|
|
||||||
|
template += "<ul>"
|
||||||
examples.forEach(function (e) {
|
examples.forEach(function (e) {
|
||||||
template += "<li>" + e.text + "</li>";
|
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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user