本文整理汇总了TypeScript中mobx.IObservableValue类的典型用法代码示例。如果您正苦于以下问题:TypeScript IObservableValue类的具体用法?TypeScript IObservableValue怎么用?TypeScript IObservableValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IObservableValue类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: is
@computed
public get is(): boolean {
// console.log(`GET:${this.objectId()}:`, this.value);
if (typeof(this.value.get()) === 'boolean') {
return this.value.get();
}
return this.parent.is;
}
示例2: verifyText
public verifyText(): string[] {
const ret: string[] = [];
if (!this.match.test(this.pin.get())) {
ret.push(`Pin does not match:${this.match.toString()}`);
}
return ret;
}
示例3: verifyText
public verifyText(): string[] {
let ret: string[] = [];
if (this.fingerprint.length == 0) {
ret.push('fingerprint had to set.');
}
if (typeof this.slot_id.get() !== 'number' && this.slot_id.get() < 0) {
ret.push('slot_id not set.');
}
if (this.card_id.length == 0) {
ret.push('card-id had to be set.');
}
ret = ret.concat(this.admin_pin.verifyText());
if (typeof this.passphrase.get() !== 'string' || this.passphrase.get().length <= 8) {
ret.push('passphrase had to be set.');
}
return ret;
}
示例4:
this.date.observe(action((chg: IValueDidChange<Date>) => {
const f = format_date(chg.newValue);
this.formatDate.set(f);
// chg.newValue.setHours(0);
// chg.newValue.setMinutes(0);
// chg.newValue.setSeconds(0);
// chg.newValue.setMilliseconds(0);
// console.log('observe fix', chg.newValue);
}));
示例5: asKeyToYubiKey
public asKeyToYubiKey(fpr: string, slot_id: number): KeyToYubiKey {
const ktyk = new KeyToYubiKey({
slot_id,
card_id: this.smartCardId.get(),
admin_pin: new Pin({ pin: '12345678'}),
fingerprint: fpr,
passphrase: this.passPhrase.getPassPhrase(),
});
return ktyk;
}
示例6: toObj
public toObj(): any {
return {
smartCardId: this.smartCardId.get(),
warrents: this.warrents.toObj(),
common: this.common.toObj(),
passPhrase: this.passPhrase.toObj(),
adminKey: this.adminKey.toObj(),
userKey: this.userKey.toObj(),
};
}
示例7: constructor
public constructor(v: Date, e: string) {
super('DateValue');
this.errText = e;
this.date = observable.box(undefined);
this.date.observe(action((chg: IValueDidChange<Date>) => {
const f = format_date(chg.newValue);
this.formatDate.set(f);
// chg.newValue.setHours(0);
// chg.newValue.setMinutes(0);
// chg.newValue.setSeconds(0);
// chg.newValue.setMilliseconds(0);
// console.log('observe fix', chg.newValue);
}));
this.formatDate = observable.box(undefined);
this.formatDate.observe(action((chg: IValueDidChange<string>) => {
this.date.set(new Date(chg.newValue));
}));
action(() => this.formatDate.set(format_date(v)))();
}
示例8: approved
@computed
public get approved(): boolean {
return this._approved.get();
}
示例9: toObj
public toObj(): DateValueObj {
return {
formatDate: this.formatDate.get(),
errText: this.errText
};
}