UrlBasedHistory constructor

UrlBasedHistory({
  1. String? base,
  2. Window? window,
})

Implementation

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

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