래핑 (wrapping) 기능을 사용하여 Google Apps Script에서 UiApp을 (프로토 타입으로) 확장하고 싶습니다. 그러나 아래 예제와 같이 간단한 샘플을 실행하면 TypeError가 발생합니다 ... 무엇이 잘못 되었나요?새로운 기능으로 UiApp을 확장하려면 어떻게해야합니까?
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);
}
감사
큰 질문입니다! {일반적인 문제이므로 UiApp뿐 아니라 GAS의 모든 Google 수업도} http://stackoverflow.com/questions/17432951/how-to-extend-google-apps-script-classes에서 자세히 설명하고 답변합니다./30539765 # 30539765,이 대답에 대한 언급과 여기에서 내가 만난 다른 모든 대답을 포함합니다. 그래서, 그게 당신을 도울 수 있다면, 거기에 내 대답을 보는 것이 좋습니다. –
클래스 UiApp가 사용되지 않으므로이 질문을 주제와 관련이 없으므로 투표를 완료하려고합니다. 참조 https://developers.google.com/apps-script/reference/ui/ui-app –