sesaparcours
    Preparing search index...

    Fake class which should be extended to avoid inheriting static properties

    Hierarchy (View Summary)

    Index

    Constructors

    • Class for one block. Not normally called directly, workspace.newBlock() is preferred.

      Parameters

      • workspace: Blockly.Workspace

        The block's workspace.

      • prototypeName: string

        Name of the language object containing type-specific functions for this block.

      • Optionalopt_id: string

        Optional ID. Use this ID if provided, otherwise create a new ID.

      Returns Blockly.Block

      When the prototypeName is not valid or not allowed.

    Properties

    comment: string | Blockly.Comment

    A string representing the comment attached to this block.

    August 2019. Use getCommentText instead.

    commentModel: CommentModel

    A model of the comment attached to this block.

    contextMenu: boolean
    data: string

    Optional text data that round-trips between blocks and XML. Has no effect. May be used by 3rd parties for meta information.

    disposed: boolean

    Has this block been disposed of?

    domToMutation: (_0: Element) => any

    An optional deserialization method for defining how to deserialize the mutation state. This must be coupled with defining mutationToDom.

    getDeveloperVariables: () => string[]

    An optional property for declaring developer variables. Return a list of variable names for use by generators. Developer variables are never shown to the user, but are declared as global variables in the generated code.

    hat: any

    Name of the type of hat.

    id: string
    init: () => any

    An optional method called during initialization.

    inputList: Input[]
    inputsInline: any
    inputsInlineDefault: any
    isInFlyout: boolean
    isInMutator: boolean
    mutationToDom: any

    An optional serialization method for defining how to serialize the mutation state. This must be coupled with defining domToMutation.

    nextConnection: Blockly.Connection
    onchange: (_0: Abstract) => any

    An optional callback method to use whenever the block's parent workspace changes. This is usually only called from the constructor, the block type initializer function, or an extension initializer function.

    outputConnection: Blockly.Connection
    previousConnection: Blockly.Connection
    rendered: boolean
    RTL: boolean
    statementInputCount: number

    A count of statement inputs on the block.

    suppressPrefixSuffix: boolean

    An optional property for suppressing adding STATEMENT_PREFIX and STATEMENT_SUFFIX to generated code.

    tooltip: TipInfo
    type: string
    workspace: Blockly.Workspace

    Methods

    • Recursively checks whether all statement and value inputs are filled with blocks. Also checks all following statement blocks in this stack.

      Parameters

      • Optionalopt_shadowBlocksAreFilled: boolean

        An optional argument controlling whether shadow blocks are counted as filled. Defaults to true.

      Returns boolean

      True if all inputs are filled, false otherwise.

    • Shortcut for appending a dummy input row.

      Parameters

      • Optionalopt_name: string

        Language-neutral identifier which may used to find this input again. Should be unique to this block.

      Returns Input

      The input object created.

    • Shortcut for appending a statement input row.

      Parameters

      • name: string

        Language-neutral identifier which may used to find this input again. Should be unique to this block.

      Returns Input

      The input object created.

    • Shortcut for appending a value input row.

      Parameters

      • name: string

        Language-neutral identifier which may used to find this input again. Should be unique to this block.

      Returns Input

      The input object created.

    • Bump unconnected blocks out of alignment. Two blocks which aren't actually connected should not coincidentally line up on screen.

      Returns void

    • Dispose of this block.

      Parameters

      • healStack: boolean

        If true, then try to heal any gap by connecting the next statement with the previous statement. Otherwise, dispose of all children of this block.

      Returns void

    • Find all the blocks that are directly nested inside this one. Includes value and statement inputs, as well as any following statement. Excludes any connection on an output tab or any preceding statement. Blocks are optionally sorted by position; top to bottom.

      Parameters

      • ordered: boolean

        Sort the list if true.

      Returns Blockly.Block[]

      Array of blocks.

    • Get the colour of a block.

      Returns string

      #RRGGBB string.

    • Returns the comment on this block (or null if there is no comment).

      Returns string

      Block's comment.

    • Returns all connections originating from this block.

      Parameters

      • _all: boolean

        If true, return all connections even hidden ones.

      Returns Blockly.Connection[]

      Array of connections.

    • Find all the blocks that are directly or indirectly nested inside this one. Includes this block in the list. Includes value and statement inputs, as well as any following statements. Excludes any connection on an output tab or any preceding statements. Blocks are optionally sorted by position; top to bottom.

      Parameters

      • ordered: boolean

        Sort the list if true.

      Returns Blockly.Block[]

      Flattened array of blocks.

    • Returns the named field from a block.

      Parameters

      • name: string

        The name of the field.

      Returns Blockly.Field

      Named field, or null if field does not exist.

    • Returns the language-neutral value of the given field.

      Parameters

      • name: string

        The name of the field.

      Returns any

      Value of the field or null if field does not exist.

    • Get the HSV hue value of a block. Null if hue not set.

      Returns number

      Hue value (0-360).

    • Get whether the block is disabled or not due to parents. The block's own disabled property is not considered.

      Returns boolean

      True if disabled.

    • Fetches the named input object.

      Parameters

      • name: string

        The name of the input.

      Returns Input

      The input object, or null if input does not exist.

    • Get whether value inputs are arranged horizontally or vertically.

      Returns boolean

      True if inputs are horizontal.

    • Fetches the block attached to the named input.

      Parameters

      • name: string

        The name of the input.

      Returns Blockly.Block

      The attached value block, or null if the input is either disconnected or if the input does not exist.

    • Return the input that connects to the specified block.

      Parameters

      • block: Blockly.Block

        A block connected to an input on this block.

      Returns Input

      The input (if any) that connects to the specified block.

    • Return the next statement block directly connected to this block.

      Returns Blockly.Block

      The next statement block or null.

    • Get the block's output shape.

      Returns number

      Value representing output shape if one exists.

    • Return the parent block or null if this block is at the top level. The parent block is either the block connected to the previous connection (for a statement block) or the block connected to the output connection (for a value block).

      Returns Blockly.Block

      The block (if any) that holds the current block.

    • Returns the block connected to the previous connection.

      Returns Blockly.Block

      The previous statement block or null.

    • Return the top-most block in this block's tree. This will return itself if this block is at the top level.

      Returns Blockly.Block

      The root block.

    • Get the name of the block style.

      Returns string

      Name of the block style.

    • Return the parent block that surrounds the current block, or null if this block has no surrounding block. A parent block might just be the previous statement, whereas the surrounding block is an if statement, while loop, etc.

      Returns Blockly.Block

      The block (if any) that surrounds the current block.

    • Returns the tooltip text for this block.

      Returns string

      The tooltip text for this block.

    • Walk up from the given block up through the stack of blocks to find the top block of the sub stack. If we are nested in a statement input only find the top-most nested block. Do not go all the way to the root block.

      Returns Blockly.Block

      The top block in a stack.

    • Return all variables referenced by this block.

      Returns string[]

      List of variable names.

    • Call initModel on all fields on the block. May be called more than once. Either initModel or initSvg must be called after creating a block and before the first interaction with it. Interactions include UI actions (e.g. clicking and dragging) and firing events (e.g. create, delete, and change).

      Returns void

    • Get whether the block is collapsed or not.

      Returns boolean

      True if collapsed.

    • Get whether this block is deletable or not.

      Returns boolean

      True if deletable.

    • Returns if this block has been disposed of / deleted.

      Returns boolean

      True if this block has been disposed of / deleted.

    • Get whether is block is duplicatable or not. If duplicating this block and descendants will put this block over the workspace's capacity this block is not duplicatable. If duplicating this block and descendants will put any type over their maxInstances this block is not duplicatable.

      Returns boolean

      True if duplicatable.

    • Get whether this block is editable or not.

      Returns boolean

      True if editable.

    • Get whether this block is enabled or not.

      Returns boolean

      True if enabled.

    • Get whether this block is an insertion marker block or not.

      Returns boolean

      True if an insertion marker.

    • Get whether this block is movable or not.

      Returns boolean

      True if movable.

    • Get whether this block is a shadow block or not.

      Returns boolean

      True if a shadow.

    • Initialize this block using a cross-platform, internationalization-friendly JSON description.

      Parameters

      • json: Object

        Structured data describing the block.

      Returns void

    • Walks down a stack of blocks and finds the last next connection on the stack.

      Parameters

      • ignoreShadows: boolean

        If true,the last connection on a non-shadow block will be returned. If false, this will follow shadows to find the last connection.

      Returns Blockly.Connection

      The last next connection on the stack, or null.

    • Add key/values from mixinObj to this block object. By default, this method will check that the keys in mixinObj will not overwrite existing values in the block, including prototype values. This provides some insurance against mixin / extension incompatibilities with future block features. This check can be disabled by passing true as the second argument.

      Parameters

      • mixinObj: Object

        The key/values pairs to add to this block object.

      • Optionalopt_disableCheck: boolean

        Option flag to disable overwrite checks.

      Returns void

    • Move a block by a relative offset.

      Parameters

      • dx: number

        Horizontal offset, in workspace units.

      • dy: number

        Vertical offset, in workspace units.

      Returns void

    • Move a named input to a different location on this block.

      Parameters

      • name: string

        The name of the input to move.

      • refName: string

        Name of input that should be after the moved input, or null to be the input at the end.

      Returns void

    • Move a numbered input to a different location on this block.

      Parameters

      • inputIndex: number

        Index of the input to move.

      • refIndex: number

        Index of input that should be after the moved input.

      Returns void

    • Remove an input from this block.

      Parameters

      • name: string

        The name of the input.

      • Optionalopt_quiet: boolean

        True to prevent an error if input is not present.

      Returns boolean

      True if operation succeeds, false if input is not present and opt_quiet is true

      if the input is not present and opt_quiet is not true.

    • Notification that a variable is renaming. If the ID matches one of this block's variables, rename it.

      Parameters

      • oldId: string

        ID of variable to rename.

      • newId: string

        ID of new variable. May be the same as oldId, but with an updated name.

      Returns void

    • Set whether the block is collapsed or not.

      Parameters

      • collapsed: boolean

        True if collapsed.

      Returns void

    • Change the colour of a block.

      Parameters

      • colour: string | number

        HSV hue value (0 to 360), #RRGGBB string, or a message reference string pointing to one of those two values.

      Returns void

    • Set this block's comment text.

      Parameters

      • text: string

        The text, or null to delete.

      Returns void

    • Set whether this block is deletable or not.

      Parameters

      • deletable: boolean

        True if deletable.

      Returns void

    • Set whether this block is editable or not.

      Parameters

      • editable: boolean

        True if editable.

      Returns void

    • Set whether the block is enabled or not.

      Parameters

      • enabled: boolean

        True if enabled.

      Returns void

    • Sets the value of the given field for this block.

      Parameters

      • newValue: any

        The value to set.

      • name: string

        The name of the field to set the value of.

      Returns void

    • Set the URL of this block's help page.

      Parameters

      • url: string | Function

        URL string for block help, or function that returns a URL. Null for no help.

      Returns void

    • Set whether value inputs are arranged horizontally or vertically.

      Parameters

      • newBoolean: boolean

        True if inputs are horizontal.

      Returns void

    • Set whether this block is an insertion marker block or not. Once set this cannot be unset.

      Parameters

      • insertionMarker: boolean

        True if an insertion marker.

      Returns void

    • Set whether this block is movable or not.

      Parameters

      • movable: boolean

        True if movable.

      Returns void

    • Give this block a mutator dialog.

      Parameters

      • _mutator: Blockly.Mutator

        A mutator dialog instance or null to remove.

      Returns void

    • Set whether another block can chain onto the bottom of this block.

      Parameters

      • newBoolean: boolean

        True if there can be a next statement.

      • Optionalopt_check: any

        Statement type or list of statement types. Null/undefined if any type could be connected.

      Returns void

    • Sets a callback function to use whenever the block's parent workspace changes, replacing any prior onchange handler. This is usually only called from the constructor, the block type initializer function, or an extension initializer function.

      Parameters

      • onchangeFn: (_0: Abstract) => any

        The callback to call when the block's workspace changes.

      Returns void

      if onchangeFn is not falsey and not a function.

    • Set whether this block returns a value.

      Parameters

      • newBoolean: boolean

        True if there is an output.

      • Optionalopt_check: any

        Returned type or list of returned types. Null or undefined if any type could be returned (e.g. variable get).

      Returns void

    • Set the block's output shape.

      Parameters

      • outputShape: number

        Value representing an output shape.

      Returns void

    • Set parent of this block to be a new block or null.

      Parameters

      Returns void

    • Set whether this block can chain onto the bottom of another block.

      Parameters

      • newBoolean: boolean

        True if there can be a previous statement.

      • Optionalopt_check: any

        Statement type or list of statement types. Null/undefined if any type could be connected.

      Returns void

    • Set whether this block is a shadow block or not.

      Parameters

      • shadow: boolean

        True if a shadow.

      Returns void

    • Set the style and colour values of a block.

      Parameters

      • blockStyleName: string

        Name of the block style.

      Returns void

    • Sets the tooltip for this block.

      Parameters

      • newTip: TipInfo

        The text for the tooltip, a function that returns the text for the tooltip, or a parent object whose tooltip will be used. To not display a tooltip pass the empty string.

      Returns void

    • Set this block's warning text.

      Parameters

      • _text: string

        The text, or null to delete.

      • Optional_opt_id: string

        An optional ID for the warning text to be able to maintain multiple warnings.

      Returns void

    • This method returns a string describing this Block in developer terms (type name and ID; English only).

      Intended to on be used in console logs and errors. If you need a string that uses the user's native language (including block text, field values, and child blocks), use [toString()]Blockly.Block#toString.

      Returns string

      The description.

    • Create a human-readable text representation of this block and any children.

      Parameters

      • Optionalopt_maxLength: number

        Truncate the string to this length.

      • Optionalopt_emptyToken: string

        The placeholder string used to denote an empty field. If not specified, '?' is used.

      Returns string

      Text of block.

    • Unplug this block from its superior block. If this block is a statement, optionally reconnect the block underneath with the block on top.

      Parameters

      • Optionalopt_healStack: boolean

        Disconnect child statement and reconnect stack. Defaults to false.

      Returns void

    • Notification that a variable is renaming but keeping the same ID. If the variable is in use on this block, rerender to show the new name.

      Parameters

      Returns void