@blockly/block-shareable-procedures
Version:
A plugin that adds procedure blocks which are backed by explicit data models.
54 lines • 1.87 kB
TypeScript
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as Blockly from 'blockly/core';
import { ProcedureBase, ProcedureBaseJson } from './events_procedure_base';
/**
* Notifies listeners that the procedure data model has been enabled or
* disabled.
*/
export declare class ProcedureEnable extends ProcedureBase {
static readonly TYPE = "procedure_enable";
/** A string used to check the type of the event. */
type: string;
private oldState;
private newState;
/**
* Constructs the procedure enable event.
*
* @param workspace The workspace this event is associated with.
* @param procedure The model this event is associated with.
* @param newState The (optional) new enabled state of the procedure model.
* If not provided, the procedure model will be inspected to determine
* its current state.
*/
constructor(workspace: Blockly.Workspace, procedure: Blockly.procedures.IProcedureModel, newState?: boolean);
/**
* Replays the event in the workspace.
*
* @param forward if true, play the event forward (redo), otherwise play it
* backward (undo).
*/
run(forward: boolean): void;
/**
* Encode the event as JSON.
*
* @returns JSON representation.
*/
toJson(): ProcedureEnableJson;
/**
* Deserializes the JSON event.
*
* @param json The JSON representation of a procedure enable event.
* @param workspace The workspace to deserialize the event into.
* @returns The new procedure enable event.
* @internal
*/
static fromJson(json: ProcedureEnableJson, workspace: Blockly.Workspace): ProcedureEnable;
}
export interface ProcedureEnableJson extends ProcedureBaseJson {
newState: boolean;
}
//# sourceMappingURL=events_procedure_enable.d.ts.map