Socket
Socket
Sign inDemoInstall

@jsdevs-sp/queue-hook

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsdevs-sp/queue-hook

## Import


Version published
Maintainers
3
Created
Source

queue-hook

Import

Web Modules

<script type="module">
  import { useQueue, getQueues, getQueuesByKey } from "https://cdn.jsdelivr.net/npm/@jsdevs-sp/queue-hook@0.0.2/lib/index.js";
</script>

Node Modules

npm install --save @jsdevs-sp/queue-hook

import { useQueue, getQueues, getQueuesByKey } from "@jsdevs-sp/queue-hook"

Usage

Manifest

const manifest = export default [
  {
    key: 'todos',
    url: 'https://jsonplaceholder.typicode.com/todos',
    loader: 'json',
    options: {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json'
      },
      mode: 'cors',
      cache: 'default'
    }
  },
  {
    key: 'article-42',
    url: 'https://jsonplaceholder.typicode.com/posts/42',
    loader: 'json',
  },
  {
    key: 'create-user',
    url: 'http://localhost:8000/api/user',
    loader: 'json',
    options: {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ a: 1, b: 2 })
    }
  },
  {
    key: 'foo',
    url: 'mock/foo.json',
    loader: 'json',
  },
  {
    key: 'bar',
    url: 'mock/bar.json',
    loader: 'json',
  },
  {
    key: 'image',
    url: 'mock/image.jpg',
    loader: 'image'
  }
]

loadQueue

import { useQueue } from  "@jsdevs-sp/queue-hook;

const { loadQueue } = useQueue('preload', manifest);

loadQueue((queue) => {
  console.log('onComplete:', queue);
});

loadQueueByItem

import { useQueue } from  "@jsdevs-sp/queue-hook;

const { loadQueueByItem } = useQueue('preload', manifest);

loadQueueByItem(({ item, progress, position }) => {
  console.log('onItemComplete', item, progress, position);
});

getQueuesByKey

import { getQueuesByKey } from  "@jsdevs-sp/queue-hook;

getQueuesByKey('preload')

getQueues

import { getQueues } from  "@jsdevs-sp/queue-hook;

getQueues()

FAQs

Package last updated on 06 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc