Sha256: e35dfd3f07918560ef284ace53bc1630c85c3570c3ab18d6ca24628e2c83262d

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

import { assign } from '@ember/polyfills';
import { shallowEqual } from '../utils';

export default class RouterState {
  constructor(emberRouter = null, routerJs = null, routerJsState = null) {
    this.emberRouter = emberRouter;
    this.routerJs = routerJs;
    this.routerJsState = routerJsState;
  }

  isActiveIntent(routeName, models, queryParams, queryParamsMustMatch) {
    let state = this.routerJsState;
    if (!this.routerJs.isActiveIntent(routeName, models, null, state)) {
      return false;
    }

    if (queryParamsMustMatch && Object.keys(queryParams).length > 0) {
      let visibleQueryParams = assign({}, queryParams);

      this.emberRouter._prepareQueryParams(routeName, models, visibleQueryParams);
      return shallowEqual(visibleQueryParams, state.queryParams);
    }

    return true;
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-routing/lib/system/router_state.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-routing/lib/system/router_state.js