[英]Object functions not showing up with console.log
OK, I'm trying to show all functions/properties of an object (specifically of an Ace editor
object), using console.log(editor)
(or console.log(editor.getSession())
for that matter) via Chrome's JavaScript Console. 好的,我试图通过Chrome的JavaScript使用console.log(editor)
(或针对此问题的console.log(editor.getSession())
显示对象(特别是Ace editor
对象)的所有功能/属性。安慰。
The thing is - having studied the very code behind Ace - I know there are functions (and I have used them) - which are not showing up when I'm trying to "print" the object. 问题是-研究了Ace背后的代码-我知道有一些函数(并且已经使用过)-当我尝试“打印”对象时这些函数没有显示。
What's going on? 这是怎么回事? How can I get the full object/function tree? 如何获得完整的对象/功能树? (preferably in some readable format) (最好是某种可读格式)
HINT: 暗示:
I actually need this in order to get a complete list of available methods (most of which is not even documented). 为了获得可用方法的完整列表,我实际上需要此方法(大多数方法甚至都没有记录)。
EDIT : 编辑:
Steps to reproduce the issue : 重现此问题的步骤:
editor.getSession()
检查editor.getSession()
editor.getSession().getBreakpoints()
is not listed 例如未列出editor.getSession().getBreakpoints()
Some frameworks override the console.log functionality. 一些框架会覆盖console.log功能。
Instead of console.log(editor)
you can write editor.valueOf()
in most cases to get all attributes and methods. 在大多数情况下,您可以编写editor.valueOf()
而不是console.log(editor)
来获取所有属性和方法。
there is also an enhanced way: 还有一种增强的方法:
for (key in editor) {
console.log(key);
console.log(editor[key]);
// or
editor[key].valueOf();
}
for(var i in ace){ console.log(i); };
或尝试
inspect(ace);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.