Skip to content

sithmel/defer-until-online

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

defer-until-online

This is a decorator that ensures that a function is deferred until the browser is online. It works for asynchronous functions (returning promises).

In my tests I noticed that you get cases where the connection is unstable (on mobile for example) and this may improve the reliability of a web app.

import deferUntilOnline from 'defer-until-online'

const deferUntil = deferUntilOnline({ timeout: 10000 })

const myfunc = deferUntil(() => {...})

const result = await myfunc(...)

The library is ES5 but requires promise polyfill

About

A decorator for ensuring that function is deferred until the browser is online

Resources

License

Stars

Watchers

Forks

Packages

No packages published