arc-ux 0.0.11 → 0.0.12
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/package.json +1 -1
- package/src/ArcUX.js +8 -0
- package/src/FrameworkComponents/App.jsx +6 -0
package/package.json
CHANGED
package/src/ArcUX.js
CHANGED
|
@@ -146,6 +146,14 @@ class ArcUX {
|
|
|
146
146
|
this.setKeyVal('route', `${this.#rootPath}${_route}`, _suppressEmit);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
pushURI(_newURI, _replace) {
|
|
150
|
+
const fullHistoryString = decodeURI(_newURI);
|
|
151
|
+
if (_replace) {
|
|
152
|
+
return window.history.replaceState({ code: fullHistoryString }, "", fullHistoryString);
|
|
153
|
+
}
|
|
154
|
+
return window.history.pushState({ code: fullHistoryString }, "", fullHistoryString);
|
|
155
|
+
}
|
|
156
|
+
|
|
149
157
|
renderModal(_Modal, _props) {
|
|
150
158
|
this.emit('modal', [_Modal, _props || {}]);
|
|
151
159
|
}
|
|
@@ -24,6 +24,12 @@ class App extends React.Component {
|
|
|
24
24
|
async componentDidMount() {
|
|
25
25
|
const initialRoute = this.props.ArcUX.getKeyVal('route');
|
|
26
26
|
|
|
27
|
+
window.onpopstate = (_event) => {
|
|
28
|
+
if (_event.state) {
|
|
29
|
+
this.props.ArcUX.loadPage(_event.state.code);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
27
33
|
this.props.ArcUX.emit('log', {message: `Our initial route is ${initialRoute}`})
|
|
28
34
|
const match = this.props.ArcUX.renderRoute(initialRoute);
|
|
29
35
|
if(match){
|