UNPKG

@blockly/block-shareable-procedures

Version:

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

64 lines 2.68 kB
/** * @license * Copyright 2022 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import * as Blockly from 'blockly/core'; import { ProcedureParameterBase, ProcedureParameterBaseJson } from './events_procedure_parameter_base'; import { ObservableParameterModel } from './observable_parameter_model'; /** * Notifies listeners that a procedure parameter was renamed. */ export declare class ProcedureParameterRename extends ProcedureParameterBase { readonly oldName: string; static readonly TYPE = "procedure_parameter_rename"; /** A string used to check the type of the event. */ type: string; /** The new name of the procedure parameter. */ private readonly newName; /** The new ID the backing variable for the parameter. */ private readonly newVarId; /** * Constructs the procedure parameter rename event. * * @param workspace The workpace this event is associated with. * @param procedure The procedure model this event is associated with. * @param parameter The parameter model this event is associated with. * @param oldName The old name of the procedure parameter. * @param newName The (optional) new name of the procedure parameter. If not * provided, the parameter model will be inspected to see what its current * name is. * @param newVarId The (optional) new id of the procedure parameter's backing * variable. If not provided, the parameter model will be inspected to * see what its current name is. */ constructor(workspace: Blockly.Workspace, procedure: Blockly.procedures.IProcedureModel, parameter: ObservableParameterModel, oldName: string, newName?: string, newVarId?: string); /** * 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(): ProcedureParameterRenameJson; /** * Deserializes the JSON event. * * @param json The JSON representation of a procedure parameter rename event. * @param workspace The workspace to deserialize the event into. * @returns The new procedure parameter rename event. * @internal */ static fromJson(json: ProcedureParameterRenameJson, workspace: Blockly.Workspace): ProcedureParameterRename; } export interface ProcedureParameterRenameJson extends ProcedureParameterBaseJson { oldName: string; newName: string; newVarId: string; } //# sourceMappingURL=events_procedure_parameter_rename.d.ts.map