Skip to content

A basic poller built on top of promises, based on the typescript.

License

Notifications You must be signed in to change notification settings

height/best-poller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Best Poller

Create Poller

let getInfo = function(key) {
	return new Promise((resolve, reject) => {
		setTimeout(() => {
			let random = Math.random()
			if (random > 0.5) {
				resolve({
					type: 'success',
					key,
					random
				})
				return
			}
			reject({
				type: 'error',
				key,
				random
			})
		}, 300)
	})
}

let polling = new Polling(iotGetWifiDeviceStatus, {
	key: 1
}, 1000, (re) => {
	// success
}, (error) => {
	// error
})

destroy

	polling.destroy()

stop

	polling.stop()

continue

	polling.continue()

About

A basic poller built on top of promises, based on the typescript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published