BundleManager.js 703 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * Bundle.js
  3. *
  4. * @author realor
  5. */
  6. import { Bundle } from './Bundle.js'
  7. class BundleManager {
  8. static _bundles = new Map()
  9. static getBundles() {
  10. return Array.from(this._bundles.values())
  11. }
  12. static setBundle(name, path) {
  13. let bundle = this._bundles.get(name)
  14. if (bundle === undefined || bundle.path !== path) {
  15. bundle = new Bundle(name, path)
  16. this._bundles.set(name, bundle)
  17. }
  18. return bundle
  19. }
  20. static getBundle(name) {
  21. return this._bundles.get(name)
  22. }
  23. static removeBundle(name) {
  24. return this._bundles.delete(name)
  25. }
  26. }
  27. export { BundleManager }