examples/fiber.js
function someAsyncFunction(file, callback) {
    // Here we just wrap the function body to make it synchronous inside
    // Sync will execute first argument 'fn' in synchronous way
    // and call second argument 'callback' when function returns
    // it also calls callback if exception will be thrown inside of 'fn'
    Sync(function(){
        var source = require('fs').readFile.sync(null, __filename);
        return source;
    }, callback)
}
function someAsyncFunction(file, callback) {
    // Here we just wrap the function body to make it synchronous inside
    // Sync will execute first argument 'fn' in synchronous way
    // and call second argument 'callback' when function returns
    // it also calls callback if exception will be thrown inside of 'fn'
    Sync(function(){
        var source = require('fs').readFile.sync(null, __filename);
        return source;
    }, callback)
}
function someAsyncFunction ( file , callback ) { // Here we just wrap the function body to make it synchronous inside // Sync will execute first argument 'fn' in synchronous way // and call second argument 'callback' when function returns // it also calls callback if exception will be thrown inside of 'fn' Sync ( function ( ) { var source = require ( 'fs' ) . readFile . sync ( null , __filename ) ; return source ; } , callback ) }
Simple asynchronous function with fiber inside example
Simple asynchronous function with fiber inside example