Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-13 13:15:38
  4. */
  5. const install = function(DC) {
  6. if (!DC || !DC.init) {
  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. name: 'dc-core',
  49. version: __VERSION__,
  50. compile_time: __TIME__,
  51. install
  52. }