Forum Discussion

avl123's avatar
avl123
New Contributor
4 years ago
Solved

UI object as an argument for a function

Hi, I have a JavaScript function performing operations on the UI object which is its argument. The functioned is called like this: myFunction(Aliases.Parent.Object).   Recently I started getting a...
  • AlexKaras's avatar
    4 years ago

    Hi,

     

    Should Aliases generally be avoided as arguments?

    It is perfectly fine to use Aliases as a function's argument.

    But one must always remember (as it is stated in the quoted log message and which is true for the non-Aliased argument as well) that if the object referenced by the current Alias is destroyed (and, optionally, recreated), this does not update the reference in the Alias but invalidates it. As the result, Alias will reference empty stub object and one must use the .RefreshMappingInfo() method call to search for the new object and refresh the object's reference stored in the Alias.