From: Emmanuel Kasper Date: Tue, 18 Oct 2016 10:13:55 +0000 (+0200) Subject: Turn PVE.Utils into a singleton X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9fa2e36d3acfe083d3b2a864610e20ec0b554940;p=pve-manager.git Turn PVE.Utils into a singleton 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. --- diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 011308ac..eb98084b 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -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); } -}}); +});