本文整理匯總了TypeScript中ember.observer函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript observer函數的具體用法?TypeScript observer怎麽用?TypeScript observer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了observer函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: testObserver
function testObserver() {
Ember.Object.extend({
valueObserver: Ember.observer('value', function() {
// Executes whenever the "value" property changes
})
});
}
示例2: function
let currency = hash.currency;
return `${currency}${cents * 0.01}`;
});
class User extends Ember.Object {
email: string;
}
class SessionService extends Ember.Service {
currentUser: User;
}
const CurrentUserEmailHelper = Ember.Helper.extend({
session: Ember.inject.service() as Ember.ComputedProperty<SessionService>,
onNewUser: Ember.observer('session.currentUser', function(this: Ember.Helper) {
this.recompute();
}),
compute(): string {
return this.get('session')
.get('currentUser')
.get('email');
},
});
import { helper } from '@ember/component/helper';
function typedHelp(/*params, hash*/) {
return 'my type of help';
}
export default helper(typedHelp);