Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useAsync hook to leverage new Hooks proposal #9

Merged
merged 22 commits into from
Dec 30, 2018
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Nicer way to pass a value to the setTimeout callback.
  • Loading branch information
ghengeveld committed Oct 29, 2018
commit 0ba881349cc8ff742a9a896c6948c79240250017
4 changes: 2 additions & 2 deletions src/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import Async, { createInstance } from "./"

afterEach(cleanup)

const resolveIn = ms => value => new Promise(resolve => setTimeout(() => resolve(value), ms))
const resolveIn = ms => value => new Promise(resolve => setTimeout(resolve, ms, value))
const resolveTo = resolveIn(0)
const rejectIn = ms => err => new Promise((resolve, reject) => setTimeout(() => reject(err), ms))
const rejectIn = ms => err => new Promise((resolve, reject) => setTimeout(reject, ms, err))
const rejectTo = rejectIn(0)

test("runs promiseFn on mount", () => {
Expand Down