@alicloud/alfa-react 1.4.30-alpha.2 → 1.4.30-alpha.3
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/dist/index.js +1 -1
- package/es/createApplication.js +16 -5
- package/es/version.js +1 -1
- package/lib/createApplication.js +16 -5
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -116,6 +116,7 @@ export default function createApplication(loader) {
|
|
|
116
116
|
var App;
|
|
117
117
|
var originalPushState;
|
|
118
118
|
var originalReplaceState;
|
|
119
|
+
var originalGo;
|
|
119
120
|
|
|
120
121
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
121
122
|
var _app$context$updateBo, _app$context, _app$context$baseFram;
|
|
@@ -174,7 +175,8 @@ export default function createApplication(loader) {
|
|
|
174
175
|
|
|
175
176
|
if (frameWindow) {
|
|
176
177
|
originalPushState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.pushState;
|
|
177
|
-
originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState;
|
|
178
|
+
originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState;
|
|
179
|
+
originalGo = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.go; // update context history according to path
|
|
178
180
|
|
|
179
181
|
if (path) originalReplaceState(null, '', path);
|
|
180
182
|
|
|
@@ -188,6 +190,10 @@ export default function createApplication(loader) {
|
|
|
188
190
|
window.history.replaceState(data, unused, "".concat($basename.current || '', "/").concat(_url).replace(/\/\//g, '/'));
|
|
189
191
|
originalReplaceState(data, unused, _url);
|
|
190
192
|
};
|
|
193
|
+
|
|
194
|
+
frameWindow.history.go = function (n) {
|
|
195
|
+
window.history.go(n);
|
|
196
|
+
};
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
|
|
@@ -213,14 +219,19 @@ export default function createApplication(loader) {
|
|
|
213
219
|
});
|
|
214
220
|
|
|
215
221
|
return function () {
|
|
216
|
-
var _App$context$baseFram;
|
|
222
|
+
var _App$context$baseFram, _App$context$baseFram2;
|
|
217
223
|
|
|
218
224
|
isUnmounted = true;
|
|
219
225
|
if (!App) return;
|
|
220
226
|
App.unmount();
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
if (
|
|
227
|
+
var frameHistory = (_App$context$baseFram = App.context.baseFrame) === null || _App$context$baseFram === void 0 ? void 0 : (_App$context$baseFram2 = _App$context$baseFram.contentWindow) === null || _App$context$baseFram2 === void 0 ? void 0 : _App$context$baseFram2.history;
|
|
228
|
+
|
|
229
|
+
if (frameHistory) {
|
|
230
|
+
if (originalPushState !== frameHistory.pushState) frameHistory.pushState = originalPushState;
|
|
231
|
+
if (originalReplaceState !== frameHistory.replaceState) frameHistory.pushState = originalReplaceState;
|
|
232
|
+
if (originalGo !== frameHistory.go) frameHistory.go = originalGo;
|
|
233
|
+
} // 在沙箱中嵌套时,必须销毁实例,避免第二次加载时异常
|
|
234
|
+
|
|
224
235
|
|
|
225
236
|
if (isOsContext()) App.destroy();
|
|
226
237
|
};
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.30-alpha.
|
|
1
|
+
export var version = '1.4.30-alpha.3';
|
package/lib/createApplication.js
CHANGED
|
@@ -138,6 +138,7 @@ function createApplication(loader) {
|
|
|
138
138
|
var App;
|
|
139
139
|
var originalPushState;
|
|
140
140
|
var originalReplaceState;
|
|
141
|
+
var originalGo;
|
|
141
142
|
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
142
143
|
var _app$context$updateBo, _app$context, _app$context$baseFram;
|
|
143
144
|
|
|
@@ -195,7 +196,8 @@ function createApplication(loader) {
|
|
|
195
196
|
|
|
196
197
|
if (frameWindow) {
|
|
197
198
|
originalPushState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.pushState;
|
|
198
|
-
originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState;
|
|
199
|
+
originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState;
|
|
200
|
+
originalGo = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.go; // update context history according to path
|
|
199
201
|
|
|
200
202
|
if (path) originalReplaceState(null, '', path);
|
|
201
203
|
|
|
@@ -209,6 +211,10 @@ function createApplication(loader) {
|
|
|
209
211
|
window.history.replaceState(data, unused, "".concat($basename.current || '', "/").concat(_url).replace(/\/\//g, '/'));
|
|
210
212
|
originalReplaceState(data, unused, _url);
|
|
211
213
|
};
|
|
214
|
+
|
|
215
|
+
frameWindow.history.go = function (n) {
|
|
216
|
+
window.history.go(n);
|
|
217
|
+
};
|
|
212
218
|
}
|
|
213
219
|
}
|
|
214
220
|
|
|
@@ -233,14 +239,19 @@ function createApplication(loader) {
|
|
|
233
239
|
});
|
|
234
240
|
});
|
|
235
241
|
return function () {
|
|
236
|
-
var _App$context$baseFram;
|
|
242
|
+
var _App$context$baseFram, _App$context$baseFram2;
|
|
237
243
|
|
|
238
244
|
isUnmounted = true;
|
|
239
245
|
if (!App) return;
|
|
240
246
|
App.unmount();
|
|
241
|
-
var
|
|
242
|
-
|
|
243
|
-
if (
|
|
247
|
+
var frameHistory = (_App$context$baseFram = App.context.baseFrame) === null || _App$context$baseFram === void 0 ? void 0 : (_App$context$baseFram2 = _App$context$baseFram.contentWindow) === null || _App$context$baseFram2 === void 0 ? void 0 : _App$context$baseFram2.history;
|
|
248
|
+
|
|
249
|
+
if (frameHistory) {
|
|
250
|
+
if (originalPushState !== frameHistory.pushState) frameHistory.pushState = originalPushState;
|
|
251
|
+
if (originalReplaceState !== frameHistory.replaceState) frameHistory.pushState = originalReplaceState;
|
|
252
|
+
if (originalGo !== frameHistory.go) frameHistory.go = originalGo;
|
|
253
|
+
} // 在沙箱中嵌套时,必须销毁实例,避免第二次加载时异常
|
|
254
|
+
|
|
244
255
|
|
|
245
256
|
if ((0, _utils.isOsContext)()) App.destroy();
|
|
246
257
|
};
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.30-alpha.
|
|
1
|
+
export declare const version = "1.4.30-alpha.3";
|