The ultimate generator based flow-control goodness for nodejs (supports thunks, promises, etc)
@assertquality
getAllLabels: {get: function () {
return $$('label,h2[id$=title],.txt888,span[class="dib ng-binding"]');
}},
getAllButtonTexts: {get: function () {
return $$('input[id*="Btn"]').getAttribute("value");
}},
I want a combine above two getters in a single getter function getAllLabelsANDButtonTexts
to return both Labels and Button Texts. How to do so?
return [this.getAllLabels(), this.getAllButtonTexts]
co
, you yield
out a Promise and you profit :P
MongoClient
has a connect method which takes a url
and then returns a Promise
co
takes a generator and iterates it for you
co
a generator and everytime you yield
a Promise, co
will call it.next()
with the resolved value
co
works
co
is implemented is interesting for sure
co
, just know that you should yield
a Promise
co
is a function that runs in your land and will iterator your generator. Part of iteration in JS means that you can feed values back into your generators
.next()
is called
yield
, you're actually suspending execution inside the generator