Constructor
#
new MoorhenCommandCentre(urlPrefix, onConsoleChanged, onCommandStart, onCommandExit, onActiveMessagesChanged, onCootInitialized)
Parameters:
Name |
Type |
Description |
urlPrefix |
string
|
The root url used to find the baby-gru/CootWorker.js worker file |
onConsoleChanged |
function
|
Callback executed whenever the worker prints a message to the console |
onCommandStart |
function
|
Callback executed whenever a new command is issued to the web worker |
onCommandExit |
function
|
Callback executed whenever a new command is completed by the web worker |
onActiveMessagesChanged |
function
|
Callback executed whenever a new message is received from the worker |
onCootInitialized |
function
|
Callback executed once after coot is initialised in the web worker |
Properties:
Name |
Type |
Description |
cootWorker |
Worker
|
A web worker holding a headless libcoot instance |
cootCommand |
function
|
Runs a coot command |
history |
moorhen.History
|
An object that contains the command history |
View Source
utils/MoorhenCommandCentre.ts, line 37
Example
import { MoorhenCommandCentre } from "moorhen";
commandCentre = new MoorhenCommandCentre({
onActiveMessagesChanged: (newActiveMessages) => {
setBusy(newActiveMessages.length !== 0)
},
onCootInitialized: () => {
setCootInitialized(true)
},
urlPrefix: urlPrefix
})
await props.commandCentre.current.cootCommand({
returnType: 'status',
command: 'flipPeptide_cid',
commandArgs: [0, "//A/150"],
})