選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-13 13:15:38
  4. */
  5. import * as turf from '@turf/turf'
  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.Namespace['turf'] = turf
  20. DC.mixin(require('./src/components.js').default)
  21. require('@dc-modules/copy-right')
  22. DC.Initialized = true
  23. callback && callback()
  24. } catch (e) {
  25. // eslint-disable-next-line no-console
  26. console.error(e)
  27. DC.Initialized = false
  28. }
  29. })
  30. } else {
  31. callback && callback()
  32. }
  33. } catch (e) {
  34. // eslint-disable-next-line no-console
  35. console.error(e)
  36. DC.Initialized = false
  37. throw e
  38. }
  39. }
  40. }
  41. /* istanbul ignore if */
  42. if (typeof window !== 'undefined' && window.DC) {
  43. install(window.DC)
  44. }
  45. export default {
  46. version: __VERSION__,
  47. compile_time: __TIME__,
  48. install
  49. }