UNPKG

@blockly/block-shareable-procedures

Version:

A plugin that adds procedure blocks which are backed by explicit data models.

53 lines 1.93 kB
/** * @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 a procedure's return type/status has changed. */ export declare class ProcedureChangeReturn extends ProcedureBase { readonly oldTypes: string[] | null; static readonly TYPE = "procedure_change"; /** A string used to check the type of the event. */ type: string; /** The new type(s) the procedure's return has been set to. */ private newTypes; /** * Constructs the procedure change event. * * @param workpace The workspace this change event is associated with. * @param procedure The model this change event is associated with. * @param oldTypes The type(s) the procedure's return was set to before it * changed. */ constructor(workpace: Blockly.Workspace, procedure: Blockly.procedures.IProcedureModel, oldTypes: string[] | null); /** * 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(): ProcedureChangeReturnJson; /** * Deserializes the JSON event. * * @param json The JSON representation of a procedure change event. * @param workspace The workspace to deserialize the event into. * @returns The new procedure change return event. * @internal */ static fromJson(json: ProcedureChangeReturnJson, workspace: Blockly.Workspace): ProcedureChangeReturn; } export interface ProcedureChangeReturnJson extends ProcedureBaseJson { oldTypes: string[] | null; } //# sourceMappingURL=events_procedure_change_return.d.ts.map