Skip to content

Commit

Permalink
core.Base: remove static registerToGlobalNs #5977
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiu committed Sep 28, 2024
1 parent e68b23a commit 31e624a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
19 changes: 7 additions & 12 deletions src/Neo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,13 @@ Neo = globalThis.Neo = Object.assign({
* @param {Neo.core.Base} cls
*/
applyToGlobalNs(cls) {
let proto = typeof cls === 'function' ? cls.prototype: cls,
className, nsArray, key, ns;
let proto = typeof cls === 'function' ? cls.prototype : cls,
className = proto.isClass ? proto.config.className : proto.className,
nsArray = className.split('.'),
key = nsArray.pop(),
ns = Neo.ns(nsArray, true);

if (proto.constructor.registerToGlobalNs === true) {
className = proto.isClass ? proto.config.className : proto.className;

nsArray = className.split('.');
key = nsArray.pop();
ns = Neo.ns(nsArray, true);
ns[key] = cls
}
ns[key] = cls
},

/**
Expand Down Expand Up @@ -571,8 +567,7 @@ const ignoreMixin = [
'isClass',
'mixin',
'ntype',
'observable',
'registerToGlobalNs'
'observable'
],

charsRegex = /\d+/g,
Expand Down
8 changes: 0 additions & 8 deletions src/core/Base.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ class Base {
* @static
*/
static overwrittenMethods = {}
/**
* Set this one to false in case you don't want to stick
* to the "anti-pattern" to apply classes to the global Neo or App namespace
* @member {Boolean} registerToGlobalNs=true
* @protected
* @static
*/
static registerToGlobalNs = true
/**
* Configs will get merged throughout the class hierarchy
* @returns {Object} config
Expand Down
9 changes: 0 additions & 9 deletions src/core/IdGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
* @singleton
*/
class IdGenerator {
/**
* Set this one to false in case you don't want to stick
* to the "anti-pattern" to apply classes to the global Neo or App namespace
* @member {Boolean} registerToGlobalNs=true
* @protected
* @static
*/
static registerToGlobalNs = true

static config = {
/**
* @member {String} className='Neo.core.IdGenerator'
Expand Down

0 comments on commit 31e624a

Please sign in to comment.