mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Move ProcedureBlock to interface
This commit is contained in:
43
core/interfaces/i_procedure_block.js
Normal file
43
core/interfaces/i_procedure_block.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview The interface for a procedure block.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Procedures.ProcedureBlock');
|
||||
|
||||
/**
|
||||
* A procedure block interface.
|
||||
* @interface
|
||||
*/
|
||||
Blockly.Procedures.ProcedureBlock = function() {};
|
||||
|
||||
/**
|
||||
* Returns the name of the procedure the procedure block calls.
|
||||
* @return {string}
|
||||
*/
|
||||
Blockly.Procedures.ProcedureBlock.prototype.getProcedureCall;
|
||||
|
||||
/**
|
||||
* Renames the procedure from the old name to the new name. If the procedure
|
||||
* block receives this and the old name matches the block's current name, it
|
||||
* should update itself to have the new name instead.
|
||||
* @param {string} oldName The old name of the procedure.
|
||||
* @param {string} newName The new name of hte procedure.
|
||||
*/
|
||||
Blockly.Procedures.ProcedureBlock.prototype.renameProcedure;
|
||||
|
||||
/**
|
||||
* Returns the signature of the procedure block's procedure definition.
|
||||
* @return {!Array} Tuple containing three elements:
|
||||
* - {string} the name of the defined procedure
|
||||
* - {!Array<string>} a list of all its arguments
|
||||
* - {boolean} whether it has a return value or not
|
||||
*/
|
||||
Blockly.Procedures.ProcedureBlock.prototype.getProcedureDef;
|
||||
@@ -25,6 +25,7 @@ goog.require('Blockly.Events.BlockChange');
|
||||
goog.require('Blockly.Field');
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('Blockly.Names');
|
||||
goog.require('Blockly.Procedures.ProcedureBlock');
|
||||
goog.require('Blockly.utils.xml');
|
||||
goog.require('Blockly.Workspace');
|
||||
goog.require('Blockly.Xml');
|
||||
@@ -47,16 +48,6 @@ Blockly.Procedures.NAME_TYPE = Blockly.PROCEDURE_CATEGORY_NAME;
|
||||
*/
|
||||
Blockly.Procedures.DEFAULT_ARG = 'x';
|
||||
|
||||
/**
|
||||
* Procedure block type.
|
||||
* @typedef {{
|
||||
* getProcedureCall: function():string,
|
||||
* renameProcedure: function(string,string),
|
||||
* getProcedureDef: function():!Array
|
||||
* }}
|
||||
*/
|
||||
Blockly.Procedures.ProcedureBlock;
|
||||
|
||||
/**
|
||||
* Find all user-created procedure definitions in a workspace.
|
||||
* @param {!Blockly.Workspace} root Root workspace.
|
||||
|
||||
Reference in New Issue
Block a user