The task interface configuration guide describes the features of the HTML/JS/CSS editor. You can also try creating a task interface in Template Builder.
This class manages the task progress, processes the task suite commands for sending responses, skipping or pausing tasks, and more. It also creates an instance of the TaskSuite class.
The Assignment
base class is available in the window.TolokaAssignment
global variable
Methods:
Task list base class builder.
Parameters:
options.assignment
— Assignment
task list model.
options.specs
— Parameters for input and output data and the task interface.
options.workspaceOptions
— Toloker's workspace initialization parameters.
Calls TaskSuite.destroy(), removes all template elements from the DOM, closes the messaging channel, stops hotkey polling and location detection, calls onDestroy
.
Hotkey handler initializer:
Resets all hotkeys (hotkeys.reset).
Calls submit() when the Enter key is pressed.
Returns assignmentId
as a string or undefined
if you are debugging the task in preview mode or using pool preview.
Returns an object with a set of parameters passed to the constructor() method during initialization.
Returns the link to an active messaging channel between the parent page and the task frame. If there is no channel, the method creates it.
Returns a link to a TaskSuite instance.
Returns document.body
for the Toloker's workspace.
Returns an object with the Toloker's workspace settings.
The most important settings:
agent
— The value is FRONTEND
for full task versions, ANDROID
for the Android app, and so forth.
isReadOnly
— "Read-only" mode flag (for example, for viewing the history of completed tasks).
isReviewMode
— Review mode flag (for example, manual review). This setting and isReadOnly
are useful if you want to do something like change the template layout in history view mode.
language
— A two-letter code of the language selected by the Toloker in Toloka settings. It's useful when you want to create multilingual templates.
origin
— Parent page FQDN.
Pauses task execution (for example, upon a request:assignment:pause
command from the main page), calls onPause
.
Collects answers to all tasks (TolokaTaskSuite.getSolutions()), validates them (TolokaTaskSuite.validate()). If validation is successful, calls strategy
, otherwise sends an assignment:validation:fail
request and an object with a list of errors returned by the validator. Parameter:
strategy
— A function that sends a message about sending results (assignment:submit
), a response array, and an assignmentId
to the parent page.Continues task execution, calls onResume
and start().
Lets you skip the current task, the same as clicking the Skip button.
Performs all the necessary actions when starting a task suite:
Adds the rendered task interface to document.body
.
Initializes hotkeys for the entire interface (InitHotkeys()).
Calls onStart
.
Collects, validates and sends completed tasks by calling provideSolutions.
Last updated:Â February 15, 2023