SCEditor
SCEditor copied to clipboard
Is there a way to use getters/setters in the code for bbcodeHandlers?
There are many places where the code checks if a property is a variable or a function in order to use its properly (value or make a call to the function). Is there a way to use getters/setters for those cases?
I had to change allowedChildren
to a function for my implementation, if was used only in one place, so it was very easy to add isFunction(allowedChildren)
where needed, but now I see that I need to have a function for isInline
as well and it's used in lots of places.
Getters/setters would be very useful in that case...
Yes from my perspective. @samclarke is the one with the authority to give your final answer, though.
The question is how to do it
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get ?
I've tried that before posing that issue and it didn't work. There are versions of used JS interfaces that support that and those that do not.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty ?
That's beyond my knowledge in JS... The first version was self explanatory and similar to other languages, I was hoping it was possible to use it, but it didn't work as it is. Maybe there is something in the environment that can be updated so we could use that syntax. Hope @samclarke can address that.