wx_mock.js 791 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import Audio from './Audio_mock'
  2. import Image from './Image_mock'
  3. import Canvas from './Canvas_mock'
  4. const wx = {
  5. getSystemInfoSync() {
  6. return {
  7. screenWidth: 300,
  8. screenHeight: 600,
  9. devicePixelRatio: 2
  10. }
  11. },
  12. createCanvas() {
  13. return new Canvas()
  14. },
  15. createImage() {
  16. return new Image()
  17. },
  18. createAudio() {
  19. return new Audio()
  20. },
  21. createInnerAudioContext() {
  22. return new Audio()
  23. },
  24. onTouchStart(callback) {
  25. },
  26. offTouchStart() {
  27. },
  28. onTouchMove(callback) {
  29. },
  30. offTouchMove() {
  31. },
  32. onTouchEnd(callback) {
  33. },
  34. offTouchEnd() {
  35. },
  36. onTouchCancel(callback) {
  37. },
  38. offTouchCancel() {
  39. },
  40. getStorageInfoSync() {
  41. return {
  42. keys: []
  43. }
  44. },
  45. getPerformance() {
  46. return {
  47. }
  48. }
  49. }
  50. module.exports = wx