Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

index.js 1.2KB

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