as usual i come here after testing around for hours and not having any clue what i am doing wrong ;-) I am not an javascript expert so i suppose this will cause some rolling eyes ;-) Sorry about that. I am now at a point where i tried to code somehting in a more readable way. Seperating functions in classes etc... What i want to achieve is something like this:
modules.create('streamModule','leftColumn')
which will call streamModule.create()NOW THE THING I DONT GET TO WORK:
Calling modules.create('streamModule','leftColumn') always results in 开发者_Go百科Reference Error: leftColumn is not defined??? The id in the call: eval(type +".create("+id+","+target")"); is always passed correctly but the target parameter is not??? What am i doing wrong?Any help would be very very appreciated!!!!! Thank you!
var modules = {
    _map    : [],
    create: function(type,target) {
    if(type == undefined) return false;
    if(target == undefined) return false;
    //Store id in map
    this._map.push(id = createID());
    //Call create function of module
    eval(type +".create("+id+","+target")");
    }
}
[...]
var streamModule = {
create: function() {
    $.log(target)
   }
}
[...]
modules.create('streamModule','leftColumn') 
Why do you need eval at all?
var modules = {
    _map    : [],
    create: function(type,target) {
    if(type == undefined) return false;
    if(target == undefined) return false;
    //Store id in map
    this._map.push(id = createID());
    //Call create function of module
    type.create(id, target);
}
[...]
var streamModule = {
   create: function(id, target) {
    $.log(target)
   }
}
[...]
modules.create(streamModule, leftColumn);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论