Track route changes as page views with AppInsights
@param options
551536
function setupPageTracking(options, Vue) {

  const router = options.router

  const baseName = options.baseName || '(Vue App)'

  router.beforeEach( (route, from, next) => {
    const name = baseName + ' / ' + route.name;
    Vue.appInsights.startTrackPage(name)
    next()
  })

  router.afterEach( route => {
    const name = baseName + ' / ' + route.name;
    const url = location.protocol + '//' + location.host + '/' + route.fullPath;
    Vue.appInsights.stopTrackPage(name, url);
  })
}
1193605
function staticViews (router, options) {
  if (!options) {
    return
  }

  Object.keys(options).filter(urlPath => options[urlPath]).forEach((urlPath) => {
    const filePath = options[urlPath]

    router.get(urlPath, (req, res) => {
      res.render(filePath)
    })
  })
}
1066789
function(options) {
      var t = this;
      t.options = options;
      t.monitor = options.monitor;

      // Call this to set the initial height/width to something
      // other than the size of the inner view elements.
      options.component.setDefaultSize({
        width: 400,
        height: 300
      });

      // Set monitor defaults.  If your view is for a specific probe,
      // then set the probeClass and any default probe initialization
      // parameters.
      if (!t.monitor.get('probeClass')) {
        t.monitor.set({
          probeClass: '{{shortAppName}}SampleProbe'
        });
      }

      // Update the view on monitor change.  The monitor isn't in
      // a connected state, so this will be called when connected.
      if (t.monitor != null) {
        t.monitor.on('change', t.onchange, t);
      }
    }
225410
function(controller, appRoutes) {
    if (!appRoutes){ return; }

    var routeNames = _.keys(appRoutes).reverse(); // Backbone requires reverted order of routes

    _.each(routeNames, function(route) {
      this._addAppRoute(controller, route, appRoutes[route]);
    }, this);
  }
209429
function (id, type) {
    if (this.state.sourcePageID !== id) {
      var selectedPage;

      this.state.pages.forEach(function (page) {
        if (parseInt(page.id, 10) === parseInt(id, 10)) {
          selectedPage = page;
        }
      });

      if (!selectedPage) {
        console.warn('Page not found.');
        return;
      }

      var currentZoom = this.state.matrix[0];
      var {x, y} = this.cartesian.getFocusTransform(selectedPage.coords, this.state.matrix[0]);
      var newState = {
        matrix: [currentZoom, 0, 0, currentZoom, x, y]
      };

      if (type === 'selected') {
        newState.selectedEl = id;
      } else if (type === 'source') {
        newState.sourcePageID = id;
      }

      this.setState(newState);
    }
  }
654411
public List<Blog> userFollowing(Map<String, ?> options) {
        return requestBuilder.get("/user/following", options).getBlogs();
    }
1047098
function (options) {
    options = options || {};
    this.id = options['id'];
    this.strict = options['strict'] || false;
    this.meta = DataTable.createMetaItems(options['meta']);
    this.enable = options['enable'] || DataTable.DEFAULTS.enable;
    this.pageSize = ko.observable(options['pageSize'] || DataTable.DEFAULTS.pageSize)
    this.pageIndex = ko.observable(options['pageIndex'] || DataTable.DEFAULTS.pageIndex)
    this.totalPages = ko.observable(options['totalPages'] || DataTable.DEFAULTS.totalPages)
    this.totalRow = ko.observable()
    this.pageCache = options['pageCache'] === undefined ? DataTable.DEFAULTS.pageCache : options['pageCache']
    this.rows = ko.observableArray([])
    this.selectedIndices = ko.observableArray([])
    this._oldCurrentIndex = -1;
    this.focusIndex = ko.observable(-1)
    this.cachedPages = []
    this.metaChange = {};
    this.valueChange = {};//ko.observable(1);
    this.currentRowChange = ko.observable(1);
    this.enableChange = ko.observable(1);
    this.params = options['params'] || {};
    this.master = options['master'] || '';
    this.allSelected = ko.observable(false);
    if (options['root']){
        this.root = options['root']
    }else{
        this.root = this;
    }
    if (options['ns']){
        this.ns = options['ns'];
    }else{
        this.ns = '';
    }
}
1276184
def list_view_changed(self, widget, event, data=None):
        
        adj = self.scrolled_window.get_vadjustment()
        adj.set_value(adj.get_upper() - adj.get_page_size())
483732
function FolderView(options) {
		this.idCount = ID_COUNT++;
		this._parent = options.parent;
		this._metadata = options.metadata;
		this.menuBar = options.menuBar;
		this.fileClient = options.fileService;
		this.progress = options.progressService;
		this.serviceRegistry = options.serviceRegistry;
		this.commandRegistry = options.commandRegistry;
		this.contentTypeRegistry = options.contentTypeRegistry;
		this.editorInputManager = options.inputManager;
		this.preferences = options.preferences;
		this.generalPrefs = new mGeneralPrefs.GeneralPreferences(this.preferences);
		this.showProjectView = options.showProjectView === undefined ? !options.metadata.Projects : options.showProjectView;
		this.showFolderNav = true;
		this._init();
	}
697794
function(options) {
        var notify = !options || !options.silent;
        var features = this.features;
        if (notify) {
            this.events.triggerEvent(
                "beforefeaturesremoved", {features: features}
            );
        }
        var feature;
        for (var i = features.length-1; i >= 0; i--) {
            feature = features[i];
            if (notify) {
                this.events.triggerEvent("beforefeatureremoved", {
                    feature: feature
                });
            }
            feature.layer = null;
            if (notify) {
                this.events.triggerEvent("featureremoved", {
                    feature: feature
                });
            }
        }
        this.renderer.clear();
        this.features = [];
        this.unrenderedFeatures = {};
        this.selectedFeatures = [];
        if (notify) {
            this.events.triggerEvent("featuresremoved", {features: features});
        }
    }
273237
private void trackJspMappings(final BundleContext bundleContext) {
		final ServiceTracker<JspMapping, JspWebElement> jspMappingTracker = JspMappingTracker
				.createTracker(extenderContext, bundleContext);

		jspMappingTracker.open();
		trackers.add(0, jspMappingTracker);
	}
338912
function() {
                    if (!can.route.currentBinding) {
                        can.route._call("bind");
                        can.route.bind("change", onRouteDataChange);
                        can.route.currentBinding = can.route.defaultBinding;
                    }
                }
613110
function(render, fn) {
      if (typeof render === 'function') {
        fn = render;
        render = false;
      }

      // separate the tracking of the application over rendered pages
      if (render) {
        app.render('partials/analytics', function(error, html) {
          if (error) {
            return fn(error);
          }

          // hack :-\ (because the HTML gets cached)
          fn(
            error,
            html.replace(config.analytics.id, config.analytics['render-id'])
          );
        });
      } else {
        // this doesn't get called anymore
        app.render('analytics', { id: app.get('analytics id') }, fn);
      }
    }
626624
function track(backend, eventName, action, label) {

        action = action || location.pathname;
        switch (backend) {

        // ##### Google-Analytics
        case "google-analytics":
            var pageTracker = window._gat && window._gat._getTracker(settings.backends[backend].accountid);
            if (! pageTracker) {
                return;
            }
            if (eventName == PAGEVIEW) {
                pageTracker._trackPageview(action);
            } else {
                // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
                pageTracker._trackEvent("pilotfish:" + eventName, action, label || "");
            }
            break;

        // ##### Mixpanel
        case "mixpanel":
            if (eventName == PAGEVIEW) {
                window.mixpanel && window.mixpanel.track_pageview(action);
            } else {
                window.mixpanel && window.mixpanel.track(eventName, {action: action, label: label});
            }
            break;

        // ##### Pilotfish Session
        case "pilotfish-session":
            var session = window.sessionStorage;

            if (! session) {
                return;
            }
            if (eventName == PAGEVIEW) {
                // Increment a counter in sessionStorage.
                // Retrieve with `Pilotfish('session', 'pageViews')`
                Pilotfish('session', 'INCR', 'pageViews');
            } else {
                // Store events in a list in sessionStorage as JSON
                // Retrieve with `Pilotfish('session', 'events')`
                Pilotfish('session', 'PUSH', 'events', {eventName: eventName, action: action, label: label});
            }
            break;

        // ##### TODO: Pilotfish API as a backend

        // ##### Quantcast
        case "quantcast":
            if (eventName == PAGEVIEW) {
                window._qevents && window._qevents.push({qacct: settings.backends[backend].accountid});
                // Reload the js. It won't *actually* reload it network-wise, because it will be cached
                Pilotfish('loadScript', (location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js");
            }
            break;


        // ##### Unrecognized
        default:
            Pilotfish('perror', "Invalid backend for recorder");
            break;
        }
    }
376773
public void showRouteOverview(int[] padding) {
    updateCameraTrackingMode(NAVIGATION_TRACKING_MODE_NONE);
    RouteInformation routeInformation = buildRouteInformationFromProgress(currentRouteProgress);
    animateCameraForRouteOverview(routeInformation, padding);
  }
1050418
def render_applicationNavigation(self, ctx, data):
        
        return applicationNavigation(
            ctx, self.translator, self.pageComponents.navigation)
554288
function queryState(defaults, options) {
  options = options || {};
  var history = options.history || windowHistory(defaults, options);
  validateHistoryAPI(history);

  history.onChanged(updateQuery)

  var query = history.get() || Object.create(null);

  var api = {

    /**
     * Gets current state.
     *
     * @param {string?} keyName if present then value for this key is returned.
     * Otherwise the entire app state is returned.
     */
    get: getValue,

    /**
     * Merges current app state with new key/value.
     *
     * @param {string} key name
     * @param {string|number|date} value
     */
    set: setValue,

    /**
     * Removes value from the query string
     */
    unset: unsetValue,

    /**
     * Similar to `set()`, but only sets value if it was not set before.
     *
     * @param {string} key name
     * @param {string|number|date} value
     */
    setIfEmpty: setIfEmpty,

    /**
     * Releases all resources acquired by query state. After calling this method
     * no hash monitoring will happen and no more events will be fired.
     */
    dispose: dispose,

    onChange: onChange,
    offChange: offChange,

    getHistoryObject: getHistoryObject,
  }

  var eventBus = eventify({});

  return api;

  function onChange(callback, ctx) {
    eventBus.on('change', callback, ctx);
  }

  function offChange(callback, ctx) {
    eventBus.off('change', callback, ctx)
  }

  function getHistoryObject() {
    return history;
  }

  function dispose() {
    // dispose all history listeners
    history.dispose();

    // And remove our own listeners
    eventBus.off();
  }

  function getValue(keyName) {
    if (keyName === undefined) return query;

    return query[keyName];
  }

  function setValue(keyName, value) {
    var keyNameType = typeof keyName;

    if (keyNameType === 'object') {
      Object.keys(keyName).forEach(function(key) {
        query[key] = keyName[key];
      });
    } else if (keyNameType === 'string') {
      query[keyName] = value;
    }

    history.set(query);

    return api;
  }

  function unsetValue(keyName) {
    if (!(keyName in query)) return; // nothing to do

    delete query[keyName];
    history.set(query);

    return api;
  }

  function updateQuery(newAppState) {
    query = newAppState;
    eventBus.fire('change', query);
  }

  function setIfEmpty(keyName, value) {
    if (typeof keyName === 'object') {
      Object.keys(keyName).forEach(function(key) {
        // TODO: Can I remove code duplication? The main reason why I don't
        // want recursion here is to avoid spamming `history.set()`
        if (key in query) return; // key name is not empty

        query[key] = keyName[key];
      });
    }

    if (keyName in query) return; // key name is not empty
    query[keyName] = value;

    history.set(query);

    return api;
  }
}