vvo/chainit — pull request #5 by christian-bromann (2014-03-05 01:04:13+00:00)
Title: skip functions

Hi

I need a functionality for WebdriverJS that makes it possible to skip a bunch of tasks. As described in camme/webdriverjs#137 it would be awesome to do something like this:

```js
client
.command() // produces an error
.command() // will be skipped because of previous error
.onError(function() {...}) // until here (executed if one of the previous two callbacks were on error)
.command() // will be executed again
.command()
```

Take a look into my changes, I hope you like the way I tried to implement it. Basically you just have to determine a function that stops the queue from skipping. I called this function `addNonSkippableFunction` - it is like adding a new function to the API with an additional flag that tells ChainIt that this function should not be skipped. Here is a simple example (I added this one in the Readme.md):

```js
// define function that stops skip process
chainit.addNonSkippableFunction(o,'stopSkiping');

var obj = new MyChainApi();

obj
.method1()
.call(function() {
// start skipping
chainit.skip(obj);
})
.method1() // will be skipped
.method2() // will be skipped
.stopSkiping(); // stops skipping
.method1() // will be executed again
```

What do you think?

Cheers