Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

This API calls an asynchronous function in a top-down manner within a fiber.

Parameters

  • The function to call. The API assumes that the function accepts a callback as its last parameter in the following format: function(error, response). This is typical for almost all asynchronous Node.js requests. You don't have to pass the callback to the API -- it is automatically appended.
  • Function parameters (optional, multiple parameters can be passed)

Return Value

The data passed to the asynchronous function callback is returned.

Exception Handling

If the callback receives an error object, this error is thrown.

Example

Run fs.readFile in a fiber
var fs = require('fs');
var text = pjs.fiber.run(fs.readFile, "somefile.txt", 'utf8');
  • No labels