您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import DC from '../base/index'
  2. /**
  3. * @Author: Caven
  4. * @Date: 2021-03-13 13:15:38
  5. */
  6. const install = function(DC) {
  7. if (!DC) {
  8. throw new Error('Missing DC Base Package')
  9. }
  10. /**
  11. * start
  12. */
  13. DC.ready = callback => {
  14. try {
  15. if (!DC.Initialized) {
  16. // load components
  17. DC.init(() => {
  18. try {
  19. DC.mixin(require('./src/components.js').default)
  20. require('@dc-modules/copy-right')
  21. if (DC.baseUrl) {
  22. const { Cesium } = DC.Namespace
  23. Cesium && Cesium.buildModuleUrl.setBaseUrl(DC.baseUrl)
  24. }
  25. DC.Initialized = true
  26. callback && callback()
  27. } catch (e) {
  28. // eslint-disable-next-line no-console
  29. console.error(e)
  30. DC.Initialized = false
  31. }
  32. })
  33. } else {
  34. callback && callback()
  35. }
  36. } catch (e) {
  37. // eslint-disable-next-line no-console
  38. console.error(e)
  39. DC.Initialized = false
  40. throw e
  41. }
  42. }
  43. }
  44. /* istanbul ignore if */
  45. if (typeof window !== 'undefined' && window.DC) {
  46. install(window.DC)
  47. }
  48. export default {
  49. version: __VERSION__,
  50. compile_time: __TIME__,
  51. install
  52. }