blockly > Block > mixin
Block.mixin() method
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.
Signature:
mixin(mixinObj: any, opt_disableCheck?: boolean): void;
Parameters
Parameter |
Type |
Description |
mixinObj |
any |
The key/values pairs to add to this block object. |
opt_disableCheck |
boolean |
(Optional) Option flag to disable overwrite checks. |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["`Block.mixin()` adds key/value pairs from a given object (`mixinObj`) to a block instance."],["By default, the method prevents overwriting existing block properties, including prototype values, ensuring compatibility."],["This overwrite check can be bypassed by setting `opt_disableCheck` to `true`."]]],["The `Block.mixin()` method adds key-value pairs from `mixinObj` to a block object. It checks for overwrites of existing keys by default, providing protection against incompatibilities. This check can be disabled with a `true` second argument. The method accepts `mixinObj` (key-value pairs) and an optional `opt_disableCheck` (boolean) flag. The return value of the method is void.\n"]]