UNPKG

@blockly/block-shareable-procedures

Version:
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 model has been renamed. */ export declare class ProcedureRename extends ProcedureBase { readonly oldName: string; static readonly TYPE = "procedure_rename"; /** A string used to check the type of the event. */ type: string; private newName; /** * Constructs the procedure rename event. * * @param workspace The workspace this event is associated with. * @param procedure The model this event is associated with. * @param oldName The old name of the procedure model. * @param newName The (optional) new name of the procedure. If not provided, * the procedure model will be inspected to see what its current * name is. */ constructor(workspace: Blockly.Workspace, procedure: Blockly.procedures.IProcedureModel, oldName: string, newName?: 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(): ProcedureRenameJson; /** * Deserializes the JSON event. * * @param json The JSON representation of a procedure rename event. * @param workspace The workspace to deserialize the event into. * @returns The new procedure rename event. * @internal */ static fromJson(json: ProcedureRenameJson, workspace: Blockly.Workspace): ProcedureRename; } export interface ProcedureRenameJson extends ProcedureBaseJson { oldName: string; newName: string; } //# sourceMappingURL=events_procedure_rename.d.ts.map