UNPKG

@blockly/block-shareable-procedures

Version:
54 lines 2.16 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 parameter has been added to a procedure model. */ export declare class ProcedureParameterCreate extends ProcedureParameterBase { readonly index: number; static readonly TYPE = "procedure_parameter_create"; /** A string used to check the type of the event. */ type: string; parameter: ObservableParameterModel; /** * Constructs the procedure parameter create event.js. * * @param workspace The workspace this event is associated with. * @param procedure The procedure model this event is associated with. * @param parameter The parameter model that was just added to the procedure. * @param index The index the parameter was inserted at. */ constructor(workspace: Blockly.Workspace, procedure: Blockly.procedures.IProcedureModel, parameter: ObservableParameterModel, index: number); /** * 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(): ProcedureParameterCreateJson; /** * Deserializes the JSON event. * * @param json The JSON representation of a procedure parameter create event. * @param workspace The workspace to deserialize the event into. * @returns The new procedure parameter create event. * @internal */ static fromJson(json: ProcedureParameterCreateJson, workspace: Blockly.Workspace): ProcedureParameterCreate; } export interface ProcedureParameterCreateJson extends ProcedureParameterBaseJson { parameter: Blockly.serialization.procedures.ParameterState; index: number; } //# sourceMappingURL=events_procedure_parameter_create.d.ts.map