node-red / node-red/node-red.github.io
Creating your own Node - where to add TypedInput on('change') event handlers
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- JavaScript
- Estrelas
- 118
- Forks
- 161
- Merge médio
- 8h 18min
- PRs com merge (30d)
- 4
Descrição
This issue is to suggest a couple of areas where documentation could be improved. Documentation is otherwise very good.
I haven't been able to find documentation for when in time to add a function to watch for change events as documented here. For example, to show/hide or enable/disable an HTML element based on a value of one of the Node properties.
Adding this within oneditprepare does not work ...
$('#node-input-instruction').on('change', (event, type, value) => {
if (value === 'turn_on') {
$('#node-wrapper-speed').typedInput('enable');
$('#node-wrapper-timeout').typedInput('enable');
} else if (value === 'turn_off') {
$('#node-wrapper-speed').typedInput('disable');
$('#node-wrapper-timeout').typedInput('disable');
}
});
... because you get an error since you can't call the typedInput function this early. Is there an official/recommended callback we should be using for once the UI has been setup (added to the DOM, or whaterver work you do)? In the meantime, I am setting hide/show directly on various elements, rather than using typedInput().
Can the documentation in Node Properties and/or TypedInput Widget be updated to make this easier to understand, to provide examples of method calls? Or maybe I've just missed something in the documentation.
If I am confused, maybe others are as well (or maybe they are better at reading documentation).
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Revise docs/creating-nodes/properties.md em “Custom edit behavior” e docs/api/ui/typedInput/index.md nas proximidades de “Methods” e “Disable state”. Compare o momento do change-event de TypedInput documentado com o exemplo de oneditprepare na issue. Está concluído quando a documentação explicar quando os handlers podem chamar os métodos de TypedInput e incluir um exemplo funcional.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript
- Domínio
- documentation
- Tipo de issue
- Documentação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 42/100