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

index.js 948B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. DC.init(() => {
  16. try {
  17. DC.mixin(require('./src/components.js').default)
  18. DC.Initialized = true
  19. callback && callback()
  20. } catch (e) {
  21. // eslint-disable-next-line no-console
  22. console.error(e)
  23. DC.Initialized = false
  24. }
  25. })
  26. } else {
  27. callback && callback()
  28. }
  29. } catch (e) {
  30. // eslint-disable-next-line no-console
  31. console.error(e)
  32. DC.Initialized = false
  33. throw e
  34. }
  35. }
  36. }
  37. /* istanbul ignore if */
  38. if (typeof window !== 'undefined' && window.DC) {
  39. install(window.DC)
  40. }
  41. export default {
  42. version: __VERSION__,
  43. compile_time: __TIME__,
  44. install
  45. }