How to know in which file that defined a js global var in chrome console?

后端 未结 3 2034
名媛妹妹
名媛妹妹 2020-12-29 20:27

How to find out which file and line a variable was defined in using google chrome console?

For example, the variable Native (from MooTools) has been def

3条回答
  •  灰色年华
    2020-12-29 21:17

    Native is defined in core.js line 437

    var Native = this.Native = function(properties){
        return new Type(properties.name, properties.initialize);
    };
    
    Native.type = Type.type;
    
    Native.implement = function(objects, methods){
        for (var i = 0; i < objects.length; i++) objects[i].implement(methods);
        return Native;
    };
    

    https://github.com/mootools/mootools-core/blob/master/Source/Core/Core.js#L437

    a quick file search for a = assignment is almost always the way to go

提交回复
热议问题