Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

vltkh/vue-idle-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vue-Idle-Queue

Build Status

Vue module that runs multiple callbacks in each requestIdleCallback until before it reaches the deadline time. It helps to execute lots of lightweight callbacks faster. This module uses promises interface to return callbacks results.

Usage

main.js:

import Vue from 'vue'
import App from './App.vue'
import VueIdleQueue from 'vue-idle-queue'

Vue.use(VueIdleQueue)

Using promise interface:

this.$onIdleQueue([
    () => {
        console.log('Im the first in queue')
        return 'result of the first callback'
    },
    () => {
        console.log('Im the second in queue')
        return 'result of the second callback'
    }
]).then(results => console.log('Queue results:', results))

Using async\await for fetching results:

const [ result1, result2 ] = await this.$onIdleQueue([
    () => {
        console.log('Im the first in queue')
        return 'result of the first callback'
    },
    () => {
        console.log('Im the second in queue')
        return 'result of the second callback'
    }
])

About

Vue wrapper for requestIdleCallback

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published