Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-11-30 20:54:58
  4. */
  5. import Fog from './type/Fog'
  6. import Rain from './type/Rain'
  7. import Snow from './type/Snow'
  8. import Cloud from './type/Cloud'
  9. class Weather {
  10. constructor() {
  11. this._comps = {
  12. fog: new Fog(),
  13. rain: new Rain(),
  14. snow: new Snow(),
  15. cloud: new Cloud()
  16. }
  17. }
  18. get fog() {
  19. return this._comps.fog
  20. }
  21. get rain() {
  22. return this._comps.rain
  23. }
  24. get snow() {
  25. return this._comps.snow
  26. }
  27. get cloud() {
  28. return this._comps.cloud
  29. }
  30. /**
  31. *
  32. * @param viewer
  33. */
  34. install(viewer) {
  35. Object.keys(this._comps).forEach(key => {
  36. this._comps[key].addTo(viewer)
  37. })
  38. Object.defineProperty(viewer, 'weather', {
  39. value: this,
  40. writable: false
  41. })
  42. }
  43. }
  44. export default Weather