@lemon-fe/mini-app 0.1.97 → 0.1.102
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.
- package/es/global.js +22 -0
- package/es/typings.d.ts +1 -0
- package/package.json +3 -3
package/es/global.js
CHANGED
|
@@ -115,6 +115,28 @@ export var mini = {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
window.mini = mini;
|
|
118
|
+
window.addEventListener('message', function (evt) {
|
|
119
|
+
var result = /^(([^:\/\s]+):\/?\/?([^\/\s@]*@)?([^\/@:]*)?:?(\d+)?)?(\/[^?]*)?(\?([^#]*))?(#[\s\S]*)?$/.exec(evt.origin);
|
|
120
|
+
|
|
121
|
+
if (result !== null && (result[4] === 'localhost' || result[4] === 'csp.nhsoft.cn' || result[4] === '127.0.0.1')) {
|
|
122
|
+
if (evt.data === 'INIT_IFRAME') {
|
|
123
|
+
window.ReactNativeWebView = {
|
|
124
|
+
postMessage: function postMessage(e) {
|
|
125
|
+
window.parent.postMessage(e, '*');
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
mini.loaded = true;
|
|
129
|
+
} else {
|
|
130
|
+
var msg = JSON.parse(evt.data);
|
|
131
|
+
|
|
132
|
+
if (msg.type === 'success') {
|
|
133
|
+
mini.methodSuccess(msg.id, msg.data);
|
|
134
|
+
} else {
|
|
135
|
+
mini.methodFail(msg.id, new Error(msg.data));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, false);
|
|
118
140
|
export function createApp(render) {
|
|
119
141
|
var count = 0;
|
|
120
142
|
|
package/es/typings.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/mini-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.102",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"color-string": "^1.9.0",
|
|
27
|
-
"react-transition-group": "^4.4.
|
|
27
|
+
"react-transition-group": "^4.4.5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.8",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"react": "^17.0.2",
|
|
36
36
|
"react-dom": "17.0.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "57ac759d854789b6b3ca42b91014fffa6ed08720"
|
|
39
39
|
}
|