Pour créer une entrée personnalisée, vous devez sous-classer Input, ou l'une des
ses sous-classes.
classMyInputextendsBlockly.inputs.Input{// The constructor should always take in a name and a block to be compatible// with JSON block definitions.constructor(name,block){super(name,block);// etc...}}
Créer une connexion (facultatif)
Si vous souhaitez que votre entrée dispose d'une connexion, créez-la dans le
en appelant la méthode makeConnection.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/09/09 (UTC).
[null,null,["Dernière mise à jour le 2024/09/09 (UTC)."],[[["Subclass `Blockly.inputs.Input` to create a custom input, ensuring the constructor accepts a name and block for JSON compatibility."],["Optionally create a connection for the input using the `makeConnection` method within the constructor."],["Register the custom input with `Blockly.registry` to enable its usage in JSON block definitions, associating it with a unique string identifier."],["Custom inputs cannot replace built-in inputs, nor can custom JSON configuration be added to built-in inputs."]]],["To create a custom input, subclass the `Input` class, including a constructor that accepts a name and block. Optionally, create a connection within the constructor using the `makeConnection` method. To use the custom input in JSON block definitions, register it with `Blockly.registry.register`, associating it with a unique string. Note that unlike custom fields, built-in inputs cannot be overridden and do not accept custom JSON configurations.\n"]]