當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript mobx.IObservableValue類代碼示例

本文整理匯總了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;
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:8,代碼來源:nested-flag.ts

示例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;
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:7,代碼來源:pin.ts

示例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;
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:17,代碼來源:key-to-yubikey.ts

示例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);
 }));
開發者ID:mabels,項目名稱:clavator,代碼行數:9,代碼來源:date-value.ts

示例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;
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:10,代碼來源:simple-yubikey.ts

示例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(),
   };
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:10,代碼來源:simple-yubikey.ts

示例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)))();
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:19,代碼來源:date-value.ts

示例8: approved

 @computed
 public get approved(): boolean {
   return this._approved.get();
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:4,代碼來源:view-warrent.ts

示例9: toObj

 public toObj(): DateValueObj {
   return {
     formatDate: this.formatDate.get(),
     errText: this.errText
   };
 }
開發者ID:mabels,項目名稱:clavator,代碼行數:6,代碼來源:date-value.ts


注:本文中的mobx.IObservableValue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。