-
In this closed issue, @hsubox76 mentions that the static version of the method for authstatechanged and beforestatechanged should be preferred over the non-static version. Does this hold true for every non-static version of a method where a static version exists? For example, the static reload vs non-static reload. Why is the static version preferred over the non-static version, is it not just a matter of preference? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Use static methods for utility, non-static for object state. Static MethodsUse when operation doesn't depend on object's state. Non-Static MethodsUse when operation depends on object's state. In context of authstatechanged and beforestatechanged, static methods likely recommended for state-independent utility. |
Beta Was this translation helpful? Give feedback.
Use static methods for utility, non-static for object state.
Static Methods
Use when operation doesn't depend on object's state.
Often more performant; no need to instantiate object.
Non-Static Methods
Use when operation depends on object's state.
Allows method chaining on the instance.
In context of authstatechanged and beforestatechanged, static methods likely recommended for state-independent utility.