如果我使用(在文本框架上):
b.selection().fit(FitOptions.frameToContent);
然后它按预期工作,这意味着所选对象有一个 fit 方法。
如果我使用:
for (var property in b.selection()) {
b.println(property);
}
在同一个选择中,它不会打印 fit 方法。
如果我使用这个:
function getMethods(obj) {
var result = [];
for (var id in obj) {
try {
if (typeof(obj[id]) == "function") {
result.push(id + ": " + obj[id].toString());
}
} catch (err) {
result.push(id + ": inaccessible");
}
}
return result;
}
b.println(getMethods(b.selection()));
然后我也没有得到 fit 方法。我真的很想知道所选对象的所有方法和属性。那么我该如何得到它们呢?