Skip to content

A simple control flow function for JavaScript promises, similar to creationix/step

License

Notifications You must be signed in to change notification settings

tlrobinson/q-step

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QStep

A simple control flow function for JavaScript promises, similar to creationix/step

Example

Using the wd WebDriver library with QProxy in CoffeeScript:

browser = QProxy(wd.promiseRemote("localhost", 4444))
loginFacebook = (credentials) ->
  QStep(
    -> browser.init(browserName: "firefox")
    -> browser.get("https://www.facebook.com/")
    -> browser.elementById("email").type(credentials.email)
    -> browser.elementById("pass").type(credentials.password)
    -> browser.elementById("u_0_b").click()
  )

Errors are propagated to the promise returned from QStep, unless they're handled within one of the steps:

loginFacebook(credentials).then ->
  console.log "success!"
, (err) ->
  console.log "error :(", err

About

A simple control flow function for JavaScript promises, similar to creationix/step

Resources

License

Stars

Watchers

Forks

Packages

No packages published