Use constants instead of magic strings for trigger names.#670
Use constants instead of magic strings for trigger names.#670
Conversation
|
I wish JS had real enums :( I find that in practise, this strings-as-fake-enums technique doesn't really end up solving any problems in javascript. |
|
Would be amazing if JS only had those! |
Use constants instead of magic strings for trigger names.
|
JS has enums, I believe I saw that in douglas crawford |
|
They still aren't real enums. The newest version of TypeScript adds real enums, or at least as real as you get in JS land. |
|
Should we Object.freeze the Types? |
|
surewhynot |
|
I though about refactoring a bit the triggers also as it's all over the place now with the hooks controller... |
In all of these occurences - we are using a magic string (stirng literal created in place) instead of a constant - just use the constant, since we have
triggers.jsimported.There are actually no more occurences of this, so we might as well continue using constants for these in future at all times.