Skip to content

Commit

Permalink
Tweaks the README
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 15, 2019
1 parent abdbdaf commit 6b4a1b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/priority-queue/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Priority Queue

This module allows you to run a queue of callback while on the browser's idle time making sure the higher-priority work is performed before.
This module allows you to run a queue of callback while on the browser's idle time making sure the higher-priority work is performed first.

## Installation

Expand All @@ -18,9 +18,12 @@ _This package assumes that your code will run in an **ES2015+** environment. If
import { createQueue } from '@wordpress/priority-queue';

const queue = createQueue();

// Context objects.
const ctx1 = {};
const ctx2 = {};

// For a given context in the queue, only the last callback is executed.
queue.add( ctx1, () => console.log( 'This will be printed first' ) );
queue.add( ctx2, () => console.log( 'This won\'t be printed' ) );
queue.add( ctx2, () => console.log( 'This will be printed second' ) );
Expand Down

0 comments on commit 6b4a1b8

Please sign in to comment.