mirror of
https://github.com/nasa/openmct.git
synced 2025-02-11 13:16:15 +00:00
[Build] Allow bundles to be removed
Allow bundles to be removed by: * Waiting for explicit activation before bootstrapping, providing a time period when bundles could be removed. * Adding a remove method to BundleRegistry
This commit is contained in:
parent
bb7f4239f6
commit
a10db656ce
@ -26,8 +26,12 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<title></title>
|
<title></title>
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="bower_components/requirejs/require.js"
|
src="bower_components/requirejs/require.js">
|
||||||
data-main="main.js">
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
require(['main'], function (mct) {
|
||||||
|
mct.run();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-32x32.png" sizes="32x32">
|
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-32x32.png" sizes="32x32">
|
||||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-96x96.png" sizes="96x96">
|
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-96x96.png" sizes="96x96">
|
||||||
|
8
main.js
8
main.js
@ -89,5 +89,11 @@ define([
|
|||||||
'./example/generator/bundle'
|
'./example/generator/bundle'
|
||||||
], function (Main, legacyRegistry) {
|
], function (Main, legacyRegistry) {
|
||||||
'use strict';
|
'use strict';
|
||||||
new Main().run(legacyRegistry);
|
|
||||||
|
return {
|
||||||
|
legacyRegistry: legacyRegistry,
|
||||||
|
run: function () {
|
||||||
|
return new Main().run(legacyRegistry);
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
@ -44,5 +44,9 @@ define(function () {
|
|||||||
return Object.keys(this.bundles);
|
return Object.keys(this.bundles);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BundleRegistry.prototype.remove = function (path) {
|
||||||
|
delete this.bundles[path];
|
||||||
|
};
|
||||||
|
|
||||||
return BundleRegistry;
|
return BundleRegistry;
|
||||||
});
|
});
|
@ -68,6 +68,21 @@ define(['./BundleRegistry'], function (BundleRegistry) {
|
|||||||
expect(bundleRegistry.get(testPath))
|
expect(bundleRegistry.get(testPath))
|
||||||
.toBe(testBundleDef);
|
.toBe(testBundleDef);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("and then removed", function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
bundleRegistry.remove(testPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("appears empty again", function () {
|
||||||
|
expect(bundleRegistry.list()).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not contain the removed bundle", function () {
|
||||||
|
expect(bundleRegistry.contains(testPath))
|
||||||
|
.toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user