我想使用包装函数在 Google Apps 脚本中扩展(原型)UiApp,但在运行如下所示的简单示例时出现 TypeError...
我究竟做错了什么?
Object.prototype.addLabel = function(text) {
this.createLabel(text);
return this;
}
function testingxUiApp() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var app = UiApp.createApplication().setTitle('playing around UiApp').setHeight("250");
var panel = app.createFlowPanel().setId('panel');
app.add(panel);
panel.add(app.addLabel("adding label for testing"));
doc.show(app);
}
thanks
无法扩展UiApp、Document、Spreadsheet 等高阶类。谷歌阻止了它。如果要执行var isObject = UiApp.createApplication() instanceof Object;
行然后isObject
是假的,尽管typeof UiApp.createApplication();
表达式返回object
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)