Sha256: fb70da6807524c710eb03c762d02b28d372965fc379a8c9d82c0ff71545d7c3c

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

import {
  updateHiddenProperty,
  resetTitleCount
} from "client-app/lib/utilities";
import { init } from "client-app/lib/preload";

export function initialize() {
  // config for moment.js
  moment.updateLocale("en", {
    relativeTime: {
      future: "in %s",
      past: "%s ago",
      s: "secs",
      m: "a min",
      mm: "%d mins",
      h: "an hr",
      hh: "%d hrs",
      d: "a day",
      dd: "%d days",
      M: "a mth",
      MM: "%d mths",
      y: "a yr",
      yy: "%d yrs"
    }
  });

  // parse preloaded json
  const dataset = document.getElementById("preloaded-data").dataset;
  init(dataset);

  // setup event for updating document title and title count
  let hiddenProperty;
  let visibilitychange;

  ["", "webkit", "ms", "moz", "ms"].forEach(prefix => {
    const check = prefix + (prefix === "" ? "hidden" : "Hidden");
    if (document[check] !== undefined && !hiddenProperty) {
      hiddenProperty = check;
      visibilitychange = prefix + "visibilitychange";
    }
  });

  updateHiddenProperty(hiddenProperty);
  document.addEventListener(
    visibilitychange,
    () => {
      resetTitleCount();
    },
    false
  );
}

export default {
  initialize
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logster-1.3.0 client-app/app/initializers/app-init.js
logster-1.3.pre client-app/app/initializers/app-init.js