Skip to content

Commit

Permalink
add reload function
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Aug 6, 2024
1 parent 971224c commit 09db7fb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,15 @@ public void invoke() {
*/
@Override
public void fireCurrentStateHistory(String title) {

fireStateInternal(StateToken.of(windowToken()).title(title).data(stateData(windowState())));
}

@Override
public void reload() {
Location location = Js.uncheckedCast(DomGlobal.location);
location.reload();
}

private void fireStateInternal(StateToken stateToken) {
EffectiveToken effectiveToken = new EffectiveToken(rootPath, stateToken);
replaceState(effectiveToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ public void invoke() {
}
}

@Override
public void reload() {
fireCurrentStateHistory();
}

private class JVMState implements State {

private final HistoryState historyState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ default boolean isInformOnPopState() {

void removeInterceptor(HistoryInterceptor interceptor);

void reload();

/** A functional interface to define a listener to be called when url state is changed. */
interface StateListener {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ public void invoke() {
}
}

@Override
public void reload() {
fireCurrentStateHistory();
}

private class TestState implements State {

private final HistoryState historyState;
Expand Down

0 comments on commit 09db7fb

Please sign in to comment.