@dwmt/loader

Simple loader component for your SPAs

Version: 1.1.2 Updated: 03/24/2021

By: dwmt License: MIT

Downloads Last 30 Days: 508

Install

npm i @dwmt/loader
yarn add @dwmt/loader

Repository: https://github.com/dwmt/loader

CDNs

bundle.run: https://bundle.run/@dwmt/loader

jsDelivr: https://cdn.jsdelivr.net/npm/@dwmt/loader

unpkg: https://unpkg.com/@dwmt/loader

@dwmt/loader

Build Status Codacy Badge codecov js-standard-style license standard-readme compliant

Loader is a simple library for easier and more reliable way to handle loading animations. You can easily define loaders globally and handle individual loaders inside front end components or backend signaling.

Table of Contents

Install

npm i @dwmt/loader

Usage

You can define loaders inside a global singleton container and retrieve it from anywhere inside your application

const LC = require('@dwmt/loader')

const globalLoader = LC.registerLoader('globalLoader')
globalLoader.reset()

// API.js

const LC = require('@dwmt/loader')

const loader = LC.getLoader('globalLoader')

const workId = loader.work()

// API slow logic

loader.terminate(workId)

You can also initiate loaders manually withoud the container

const Loader = require('@dwmt/loader/lib/Loader')

const buttonLoader = new Loader()
buttonLoader.onActivation(() => {
  // show loader
})

buttonLoader.onTermination(() => {
  // hide loader
})

const workId = buttonLoader.work()

buttonLoader.terminate(workId)

API

Contributing

See the contributing file!

PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © dwmt.

Categories: Vue js