knockout-contrib

:metal: KnockoutJS Goodies Monorepo

View the Project on GitHub Profiscience/knockout-contrib

router.middleware.loading

Version Dependency Status Peer Dependency Status Dev Dependency Status Downloads

NOTE: This package is intended for consumption via the @profiscience/knockout-contrib metapackage

Eases creation of loading middlware

Usage

import { Router, createLoadingMiddleware } from '@profiscience/knockout-contrib'

Router.use(
  createLoadingMiddleware({
    start() {
      showLoader()
    },
    end() {
      hideLoader()
    },

    /* OPTIONAL */
    minDuration: 0, // prevent flickering on fast navigation (show loader for at least <n> ms)
  })
)