You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2020/05/20 11:55:50 UTC
[royale-asjs] branch develop updated: Add a static counter for uids.
This is an automated email from the ASF dual-hosted git repository.
yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 90a703b Add a static counter for uids.
90a703b is described below
commit 90a703be9a13b0730c728e66a06c2737085ff863
Author: DESKTOP-RH4S838\Yishay <yi...@hotmail.com>
AuthorDate: Wed May 20 14:53:02 2020 +0300
Add a static counter for uids.
Reference #536.
---
.../MXRoyale/src/main/royale/mx/core/UIComponent.as | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index ecd366d..c5fa102 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -598,6 +598,8 @@ public class UIComponent extends UIBase
// When changing this constant, make sure you change
// the constant with the same name in LayoutElementUIComponentUtils
+ private static var sessionId:int;
+
//--------------------------------------------------------------------------
//
// Class properties
@@ -4814,7 +4816,16 @@ COMPILE::JS
public function get uid():String
{
if (!_uid)
- _uid = toString();
+ {
+ COMPILE::SWF
+ {
+ _uid = toString();
+ }
+ COMPILE::JS // toString() doesn't give a unique id, a static var will at least be good for a session
+ {
+ _uid = "session_id" + sessionId++;
+ }
+ }
return _uid;
}