Js.input.read
From Web Computing Documentation
(Difference between revisions)
Line 13: | Line 13: | ||
This function can be used to grab the input data at the beginning of a computation. If your input is JSON and you need to work with an object input, you can use [[js.evalJson]]. |
This function can be used to grab the input data at the beginning of a computation. If your input is JSON and you need to work with an object input, you can use [[js.evalJson]]. |
||
− | |||
==Examples== |
==Examples== |
||
− | |||
<syntaxhighlight lang="javascript"> |
<syntaxhighlight lang="javascript"> |
Revision as of 11:23, 7 July 2011
Description
Returns the input string provided by the work source corresponding to the given name. Returns null if the work source doesn't contain an input under the given a name.
js.input.read( name )
name The name of the required input.
This function can be used to grab the input data at the beginning of a computation. If your input is JSON and you need to work with an object input, you can use js.evalJson.
Examples
var input = js.input.read("initialParameters"); if(input == null) return -1; //No input found with the given name
initialParameters is an input name contained in the work source. For example in a BOINC project it is the logical name for the input data given in the workunit template.