]> git.proxmox.com Git - pve-manager.git/commitdiff
Turn PVE.Utils into a singleton
authorEmmanuel Kasper <e.kasper@proxmox.com>
Tue, 18 Oct 2016 10:13:55 +0000 (12:13 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 18 Oct 2016 10:40:28 +0000 (12:40 +0200)
This will allow us to add contructed values ( regexp a = stringA + stringB )
into the constructor.
Access to the PVE.Utils properties and methods stays the same.

www/manager6/Utils.js

index 011308ac8eb1ca09fed6e3a65ab7114cd42f1f5f..eb98084b3ec3571492e763e071212a0e2e6580d9 100644 (file)
@@ -63,9 +63,9 @@ var HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(:
 var HostPortBrackets_match = new RegExp("^\\[(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](:\\d+)?$");
 var IP6_dotnotation_match = new RegExp("^" + IPV6_REGEXP + "(\\.\\d+)?$");
 
-Ext.define('PVE.Utils', { statics: {
+Ext.define('PVE.Utils', { utilities: {
 
-    // this class only contains static functions
+    // this singleton contains miscellaneous utilities
 
     toolkit: undefined, // (extjs|touch), set inside Toolkit.js
 
@@ -1277,6 +1277,12 @@ Ext.define('PVE.Utils', { statics: {
        }
 
        menu.showAt(event.getXY());
+    }},
+
+    singleton: true,
+    constructor: function() {
+       var me = this;
+       Ext.apply(me, me.utilities);
     }
-}});
+});