Extend Function.prototype for Fibers #97

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

Allow to use Fibers in context...

Example

(function() {
 console.log( (require("fs").readdir.toSync)(".") );
}).asFiber;

asFiber extension

before

(require("fibers")(function() { /* function code */ })).run()

after

(function() { /* function code */ }).asFiber

toSync extension

before

(require("fibers/future").wrap(asyncFunction))(asyncArguments).wait()

after

(asyncFunction.toSync)(asyncArguments)
Extend Function.prototype for Fibers
Allow to use Fibers in context...

Example
```javascript
(function() {
  console.log( (require("fs").readdir.toSync)(".") );
}).asFiber;
```

<b>asFiber</b> extension

before
```javascript
(require("fibers")(function() { /* function code */ })).run()
```
after
```javascript
(function() { /* function code */ }).asFiber 
```
<b>toSync</b> extension

before
```javascript
(require("fibers/future").wrap(asyncFunction))(asyncArguments).wait()
```
after
```javascript
(asyncFunction.toSync)(asyncArguments)
```
Owner

laverdet commented Jan 6, 2013

I do not like this.. This is probably something better left in your application code. Thank you for the suggestions though.

@laverdet laverdet closed this Jan 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment