By example:
class Component { }
class A extends Component {
static path = /^/models/a/([z-a]+?)/$/;
}
class B extends Model {
static path = /^/models/b/([z-a]+?)/$/;
}
I need declare a global function to process the path but from extended class or a extended prototype without initialize the classes, like as:
const paths = [ A.path, B.path ];
...
new A();
But need made as global like as:
Component.prototype.getRouteParams = async function(){
return document.location.hash.slice(1).match(this.route);
}
But from function can not access to static value using this
, works fine using A.route
, but, how to access to const from a global function agnostic to the class without use eval
for security reasons?