@mpxjs/api-proxy 2.9.6 → 2.9.11-test.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/package.json +2 -2
  2. package/src/common/js/index.js +0 -1
  3. package/src/{mini → common/js}/promisify.js +4 -2
  4. package/src/common/js/utils.js +32 -1
  5. package/src/common/js/web.js +25 -15
  6. package/src/index.js +4 -75
  7. package/src/install.js +62 -0
  8. package/src/{web → platform}/api/action-sheet/ActionSheet.js +6 -6
  9. package/src/platform/api/action-sheet/index.ali.js +28 -0
  10. package/src/platform/api/action-sheet/index.js +9 -0
  11. package/src/platform/api/add-phone-contact/index.ali.js +13 -0
  12. package/src/platform/api/add-phone-contact/index.js +9 -0
  13. package/src/platform/api/animation/index.js +9 -0
  14. package/src/platform/api/app/index.js +24 -0
  15. package/src/platform/api/audio/index.js +9 -0
  16. package/src/platform/api/base/index.js +12 -0
  17. package/src/platform/api/ble-connection/index.ali.js +17 -0
  18. package/src/platform/api/ble-connection/index.js +15 -0
  19. package/src/platform/api/canvas/index.ali.js +16 -0
  20. package/src/platform/api/canvas/index.js +15 -0
  21. package/src/platform/api/check-session/index.js +9 -0
  22. package/src/platform/api/clipboard-data/index.ali.js +30 -0
  23. package/src/platform/api/clipboard-data/index.js +12 -0
  24. package/src/platform/api/create-intersection-observer/index.ali.js +7 -0
  25. package/src/platform/api/create-intersection-observer/index.js +9 -0
  26. package/src/platform/api/create-selector-query/index.ali.js +35 -0
  27. package/src/platform/api/create-selector-query/index.js +9 -0
  28. package/src/platform/api/device/network/index.js +15 -0
  29. package/src/platform/api/file/index.ali.js +35 -0
  30. package/src/platform/api/file/index.js +12 -0
  31. package/src/platform/api/get-user-info/index.ali.js +18 -0
  32. package/src/platform/api/get-user-info/index.js +9 -0
  33. package/src/platform/api/image/index.ali.js +36 -0
  34. package/src/platform/api/image/index.js +12 -0
  35. package/src/platform/api/login/index.ali.js +15 -0
  36. package/src/platform/api/login/index.js +9 -0
  37. package/src/platform/api/make-phone-call/index.ali.js +12 -0
  38. package/src/platform/api/make-phone-call/index.js +9 -0
  39. package/src/{web → platform}/api/modal/Modal.js +2 -7
  40. package/src/platform/api/modal/index.ali.js +32 -0
  41. package/src/platform/api/modal/index.js +9 -0
  42. package/src/platform/api/next-tick/index.ali.js +7 -0
  43. package/src/platform/api/next-tick/index.js +9 -0
  44. package/src/platform/api/next-tick/index.tt.js +7 -0
  45. package/src/platform/api/page-scroll-to/index.js +9 -0
  46. package/src/platform/api/pull-down/index.js +12 -0
  47. package/src/{web/api/pull-down/index.js → platform/api/pull-down/index.web.js} +14 -22
  48. package/src/platform/api/request/index.ali.js +26 -0
  49. package/src/platform/api/request/index.js +9 -0
  50. package/src/{web/api/request/index.js → platform/api/request/index.web.js} +2 -5
  51. package/src/platform/api/request-payment/index.ali.js +45 -0
  52. package/src/platform/api/request-payment/index.js +9 -0
  53. package/src/platform/api/route/index.js +21 -0
  54. package/src/{web/api/route/index.js → platform/api/route/index.web.js} +59 -80
  55. package/src/platform/api/scan-code/index.ali.js +17 -0
  56. package/src/platform/api/scan-code/index.js +9 -0
  57. package/src/platform/api/screen-brightness/index.ali.js +26 -0
  58. package/src/platform/api/screen-brightness/index.js +12 -0
  59. package/src/platform/api/set-navigation-bar/index.ali.js +25 -0
  60. package/src/platform/api/set-navigation-bar/index.js +12 -0
  61. package/src/{web/api/set-navigation-bar/index.js → platform/api/set-navigation-bar/index.web.js} +0 -1
  62. package/src/{web → platform}/api/socket/SocketTask.js +1 -1
  63. package/src/platform/api/socket/index.js +9 -0
  64. package/src/platform/api/storage/index.ali.js +59 -0
  65. package/src/platform/api/storage/index.js +36 -0
  66. package/src/{web/api/storage/index.js → platform/api/storage/index.web.js} +0 -10
  67. package/src/platform/api/system/index.ali.js +38 -0
  68. package/src/platform/api/system/index.js +12 -0
  69. package/src/{web/api/system/index.js → platform/api/system/index.web.js} +0 -1
  70. package/src/platform/api/tab-bar/index.js +18 -0
  71. package/src/{web/api/tab-bar/index.js → platform/api/tab-bar/index.web.js} +0 -8
  72. package/src/{web → platform}/api/toast/Toast.js +1 -3
  73. package/src/platform/api/toast/index.ali.js +39 -0
  74. package/src/platform/api/toast/index.js +18 -0
  75. package/src/platform/api/video/index.js +9 -0
  76. package/src/platform/api/window/index.js +12 -0
  77. package/src/platform/index.js +106 -0
  78. package/src/common/js/ToPromise.js +0 -25
  79. package/src/index.web.js +0 -24
  80. package/src/mini/platform/wxToAli.js +0 -667
  81. package/src/mini/platform/wxToQq.js +0 -20
  82. package/src/mini/platform/wxToTt.js +0 -9
  83. package/src/mini/transform.js +0 -71
  84. package/src/web/api/index.js +0 -68
  85. /package/src/{web/api/action-sheet/index.js → platform/api/action-sheet/index.web.js} +0 -0
  86. /package/src/{web → platform}/api/animation/animation.js +0 -0
  87. /package/src/{web/api/animation/index.js → platform/api/animation/index.web.js} +0 -0
  88. /package/src/{web/api/app/index.js → platform/api/app/index.web.js} +0 -0
  89. /package/src/{web/api/audio/index.js → platform/api/audio/index.web.js} +0 -0
  90. /package/src/{web → platform}/api/base/base64.js +0 -0
  91. /package/src/{web/api/base/index.js → platform/api/base/index.web.js} +0 -0
  92. /package/src/{web → platform}/api/create-intersection-observer/IntersectionObserver.js +0 -0
  93. /package/src/{web/api/create-intersection-observer/index.js → platform/api/create-intersection-observer/index.web.js} +0 -0
  94. /package/src/{web → platform}/api/create-selector-query/NodesRef.js +0 -0
  95. /package/src/{web → platform}/api/create-selector-query/SelectQuery.js +0 -0
  96. /package/src/{web/api/create-selector-query/index.js → platform/api/create-selector-query/index.web.js} +0 -0
  97. /package/src/{web → platform}/api/device/network/getNetworkType.js +0 -0
  98. /package/src/{web/api/device/network/index.js → platform/api/device/network/index.web.js} +0 -0
  99. /package/src/{web → platform}/api/device/network/onNetworkStatusChange.js +0 -0
  100. /package/src/{web/api/event-channel/index.js → platform/api/event-channel/index.web.js} +0 -0
  101. /package/src/{web/api/preview-image → platform/api/image}/Preview.js +0 -0
  102. /package/src/{web/api/preview-image/index.js → platform/api/image/index.web.js} +0 -0
  103. /package/src/{web/api/modal/index.js → platform/api/modal/index.web.js} +0 -0
  104. /package/src/{web/api/next-tick/index.js → platform/api/next-tick/index.web.js} +0 -0
  105. /package/src/{web/api/page-scroll-to/index.js → platform/api/page-scroll-to/index.web.js} +0 -0
  106. /package/src/{web → platform}/api/request/RequestTask.js +0 -0
  107. /package/src/{web/api/socket/index.js → platform/api/socket/index.web.js} +0 -0
  108. /package/src/{web/api/toast/index.js → platform/api/toast/index.web.js} +0 -0
  109. /package/src/{web/api/video/index.js → platform/api/video/index.web.js} +0 -0
  110. /package/src/{web/api/window/index.js → platform/api/window/index.web.js} +0 -0
@@ -0,0 +1,9 @@
1
+ import { getEnvObj, envError } from '../../../common/js'
2
+
3
+ const ENV_OBJ = getEnvObj()
4
+
5
+ const createVideoContext = ENV_OBJ.createVideoContext || envError('createVideoContext')
6
+
7
+ export {
8
+ createVideoContext
9
+ }
@@ -0,0 +1,12 @@
1
+ import { getEnvObj, envError } from '../../../common/js'
2
+
3
+ const ENV_OBJ = getEnvObj()
4
+
5
+ const onWindowResize = ENV_OBJ.onWindowResize || envError('onWindowResize')
6
+
7
+ const offWindowResize = ENV_OBJ.offWindowResize || envError('offWindowResize')
8
+
9
+ export {
10
+ onWindowResize,
11
+ offWindowResize
12
+ }
@@ -0,0 +1,106 @@
1
+ // showActionSheet
2
+ export * from './api/action-sheet'
3
+
4
+ // addPhoneContact
5
+ export * from './api/add-phone-contact'
6
+
7
+ // createAnimation
8
+ export * from './api/animation'
9
+
10
+ // onAppShow, onAppHide, offAppShow, offAppHide, onError, offError
11
+ export * from './api/app'
12
+
13
+ // createInnerAudioContext
14
+ export * from './api/audio'
15
+
16
+ // base64ToArrayBuffer, arrayBufferToBase64
17
+ export * from './api/base'
18
+
19
+ // closeBLEConnection, createBLEConnection, onBLEConnectionStateChange
20
+ export * from './api/ble-connection'
21
+
22
+ // createCanvasContext, canvasToTempFilePath, canvasGetImageData
23
+ export * from './api/canvas'
24
+
25
+ // checkSession
26
+ export * from './api/check-session'
27
+
28
+ // setClipboardData, getClipboardData
29
+ export * from './api/clipboard-data'
30
+
31
+ // createIntersectionObserver
32
+ export * from './api/create-intersection-observer'
33
+
34
+ // createSelectorQuery
35
+ export * from './api/create-selector-query'
36
+
37
+ // getNetworkType, onNetworkStatusChange, offNetworkStatusChange
38
+ export * from './api/device/network'
39
+
40
+ // downloadFile, uploadFile
41
+ export * from './api/file'
42
+
43
+ // getUserInfo
44
+ export * from './api/get-user-info'
45
+
46
+ // previewImage, compressImage
47
+ export * from './api/image'
48
+
49
+ // login
50
+ export * from './api/login'
51
+
52
+ // makePhoneCall
53
+ export * from './api/make-phone-call'
54
+
55
+ // showModal
56
+ export * from './api/modal'
57
+
58
+ // nextTick
59
+ export * from './api/next-tick'
60
+
61
+ // pageScrollTo
62
+ export * from './api/page-scroll-to'
63
+
64
+ // stopPullDownRefresh
65
+ export * from './api/pull-down'
66
+
67
+ // request
68
+ export * from './api/request'
69
+
70
+ // requestPayment
71
+ export * from './api/request-payment'
72
+
73
+ // redirectTo, navigateTo, navigateBack, reLaunch, switchTab
74
+ export * from './api/route'
75
+
76
+ // scanCode
77
+ export * from './api/scan-code'
78
+
79
+ // setScreenBrightness, getScreenBrightness
80
+ export * from './api/screen-brightness'
81
+
82
+ // setNavigationBarTitle, setNavigationBarColor
83
+ export * from './api/set-navigation-bar'
84
+
85
+ // connectSocket
86
+ export * from './api/socket'
87
+
88
+ // setStorage, setStorageSync, getStorage, getStorageSync
89
+ // getStorageInfo, getStorageInfoSync, removeStorage, removeStorageSync
90
+ // clearStorage, clearStorageSync
91
+ export * from './api/storage'
92
+
93
+ // getSystemInfo, getSystemInfoSync
94
+ export * from './api/system'
95
+
96
+ // setTabBarItem, setTabBarStyle, showTabBar, hideTabBar
97
+ export * from './api/tab-bar'
98
+
99
+ // showToast, hideToast, showLoading, hideLoading
100
+ export * from './api/toast'
101
+
102
+ // createVideoContext
103
+ export * from './api/video'
104
+
105
+ // onWindowResize, offWindowResize
106
+ export * from './api/window'
@@ -1,25 +0,0 @@
1
- class ToPromise {
2
- constructor () {
3
- this._resolve = null
4
- this._reject = null
5
- }
6
-
7
- toPromiseInitPromise () {
8
- return new Promise((resolve, reject) => {
9
- this._resolve = resolve
10
- this._reject = reject
11
- })
12
- }
13
-
14
- toPromiseResolve (res) {
15
- this._resolve(res)
16
- }
17
-
18
- toPromiseReject (err) {
19
- this._reject(err)
20
- }
21
- }
22
-
23
- export {
24
- ToPromise
25
- }
package/src/index.web.js DELETED
@@ -1,24 +0,0 @@
1
- import * as allApi from './web/api'
2
- import { genFromMap } from './common/js'
3
-
4
- export default function install (target) {
5
- const fromMap = genFromMap()
6
-
7
- Object.keys(allApi).forEach(api => {
8
- target[api] = function (...args) {
9
- if (args.length > 0) {
10
- const from = args.pop()
11
- if (typeof from !== 'string' || !fromMap[from]) {
12
- args.push(from)
13
- }
14
- }
15
-
16
- return allApi[api].apply(target, args)
17
- }
18
- })
19
- }
20
- export function getProxy () {
21
- const apiProxy = {}
22
- install(apiProxy)
23
- return apiProxy
24
- }