Workunit API

From Web Computing Documentation
Jump to: navigation, search

In order to communicate with the framework the actual distributed application needs to use the JavaScript functions of the workunit interface contained in the file worker.js. These functions are

  • js.input.read(name) — Reads the input corresponding to the given name
  • js.work.setProgress(rate) — Reports the percentage of progress to the framework
  • js.work.setCheckpoint(object) — Saves checkpoint data to the persistent storage
  • js.work.getCheckpoint( ) — Retrieves the last checkpoint from the persistent storage
  • js.work.debug(string) — Sends a debug message to the framework.
  • js.output.write(name, string) — Writes the given data to the selected output stream
  • js.output.writeLine(name, string) — Writes the given data with newline to the selected output stream
  • js.evalJson(object) — Evaluates a JSON string and returns the corresponding object
  • js.toJson(object) — Creates a JSON string from a given object

To be implemented

  • js.canvas.clear
  • js.canvas.beginPath
  • js.canvas.moveTo
  • js.canvas.lineTo
  • js.canvas.arc
  • js.canvas.stroke
  • js.canvas.fill
  • js.canvas.fillRect
  • js.canvas.fillText
  • js.canvas.setFillStyle
  • js.canvas.setLineWidth
  • js.canvas.setFont
  • js.canvas.draw
Personal tools
Modules