엠버 클래스를 조건부로 확장 할 수 있습니까? 이런 식으로 뭔가 : 상태에서 엠버 클래스 확장하기
A.reopen({
if (condition) {
init: function() {
this.super();
// some functionality
}.on('didInsertElement');
}
})
은 현재 내가 가지고 같은 패턴 :
A.reopen({
init: function() {
this.super();
if (condition) {
// some stuff
}
}.on('didInsertElement'),
cleanup: function() {
if (condition) {
// some stuff
}
}.on('willDestroyElement')
})
나는 이런 내 패턴을 단순화 할 수 있습니다 조건으로 클래스를 확장 할 수 있는지 짐작 :
A.reopen({
if (condition) {
init: function() {
this.super();
// some functionality
}.on('didInsertElement'),
clear_up: function() {
// some stuff
}.on('willDestroyElement')
}
})
모두 플러그인에서 만든 클래스 확장 discourse
왜 첫 번째와 두 번째 줄을 전환하지 않습니까? 재개하려는 클래스와 사용 사례는 무엇입니까? – Keo
@Keo 사례를 명확히하기 위해 질문을 업데이트했습니다. – megas
Keo의 답변이 도움이되지 않습니까? 'if (condition) { A.reopen ({' – ykaragol