Skip to content

Commit 94319df

Browse files
authored
Merge pull request nasa#1371 from nasa/plugins-1248
[Plugins] Expose plugin functions
2 parents d37caa7 + 1666c42 commit 94319df

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

API.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,26 @@ openmct.install(myPlugin);
265265

266266
The plugin will be invoked to configure Open MCT before it is started.
267267

268+
### Included Plugins
269+
270+
Open MCT is packaged along with a few general-purpose plugins:
271+
272+
* `openmct.plugins.localStorage` provides persistence of user-created
273+
objects in browser-local storage. This is particularly useful in
274+
development environments.
275+
* `openmct.plugins.myItems` adds a top-level folder named "My Items"
276+
when the application is first started, providing a place for a
277+
user to store created items.
278+
279+
Generally, you will want to either install these plugins, or install
280+
different plugins that provide persistence and an initial folder
281+
hierarchy. Installation is as described [above](#installing-plugins):
282+
283+
```
284+
openmct.install(openmct.plugins.localStorage);
285+
openmct.install(openmct.plugins.myItems);
286+
```
287+
268288
### Writing Plugins
269289

270290
Plugins configure Open MCT, and should utilize the

src/MCT.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ define([
2727
'./api/api',
2828
'./selection/Selection',
2929
'./api/objects/object-utils',
30+
'./plugins/plugins',
3031
'./ui/ViewRegistry'
3132
], function (
3233
EventEmitter,
@@ -35,6 +36,7 @@ define([
3536
api,
3637
Selection,
3738
objectUtils,
39+
plugins,
3840
ViewRegistry
3941
) {
4042
/**
@@ -278,5 +280,7 @@ define([
278280
plugin(this);
279281
};
280282

283+
MCT.prototype.plugins = plugins;
284+
281285
return MCT;
282286
});

src/plugins/plugins.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*****************************************************************************
2+
* Open MCT, Copyright (c) 2014-2016, United States Government
3+
* as represented by the Administrator of the National Aeronautics and Space
4+
* Administration. All rights reserved.
5+
*
6+
* Open MCT is licensed under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations
15+
* under the License.
16+
*
17+
* Open MCT includes source code licensed under additional open source
18+
* licenses. See the Open Source Licenses file (LICENSES.md) included with
19+
* this source code distribution or the Licensing information page available
20+
* at runtime from the About dialog for additional information.
21+
*****************************************************************************/
22+
23+
define([
24+
], function () {
25+
return {
26+
localStorage: function (openmct) {
27+
openmct.legacyRegistry.enable('platform/persistence/local');
28+
},
29+
myItems: function (openmct) {
30+
openmct.legacyRegistry.enable('platform/features/my-items');
31+
}
32+
};
33+
});

0 commit comments

Comments
 (0)