UrlBasedHistory constructor

UrlBasedHistory({
  1. Window? window,
})

Implementation

UrlBasedHistory({web.Window? window}) {
  this.window = window ?? web.document.defaultView ?? web.window;
  index = state?.index ?? 0;
  if (index == 0) {
    final state = _HistoryState(
      identifier: this.state?.identifier ?? generateIdentifier(),
      userData: this.state?.userData,
      index: index,
    );
    this.window.history.replaceState(state.toJson().jsify(), '');
  }

  this.window.addEventListener('popstate', didPopJsFunction);
}