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


TypeScript ObserverLocator.getObserver方法代碼示例

本文整理匯總了TypeScript中aurelia-framework.ObserverLocator.getObserver方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ObserverLocator.getObserver方法的具體用法?TypeScript ObserverLocator.getObserver怎麽用?TypeScript ObserverLocator.getObserver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在aurelia-framework.ObserverLocator的用法示例。


在下文中一共展示了ObserverLocator.getObserver方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: valueChanged

 public valueChanged(newValue: Command, oldValue: Command): void {
     this.command = newValue;
     
     if (oldValue) {
         this.observerLocator
             .getObserver(oldValue, "isExecuting")
             .unsubscribe(this.onCommandIsExecutingChanged.bind(this));         
             
         this.observerLocator
             .getObserver(oldValue, "canExecute")
             .unsubscribe(this.onCommandCanExecuteChanged.bind(this));
     }
     
     if (newValue) {
         this.observerLocator
             .getObserver(newValue, "isExecuting")
             .subscribe(this.onCommandIsExecutingChanged.bind(this));
             
         this.observerLocator
             .getObserver(newValue, "canExecute")
             .subscribe(this.onCommandCanExecuteChanged.bind(this));
             
         this.onCommandIsExecutingChanged(this.command.isExecuting, undefined);
         this.onCommandCanExecuteChanged(this.command.canExecute, undefined);                
     }        
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:26,代碼來源:button-command.ts

示例2: commandChanged

 public commandChanged(newValue: Command, oldValue: Command) {
     
     if (oldValue) {
         this.observerLocator
             .getObserver(oldValue, "error")
             .unsubscribe(this.onCommandErrorChanged.bind(this));    
     }                
     
     if (newValue) {
         this.observerLocator
             .getObserver(newValue, "error")
             .subscribe(this.onCommandErrorChanged.bind(this));
     }
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:14,代碼來源:command-error.ts

示例3: observeProperties

  observeProperties(properties, callback:IChangedPropertyCallback) {//:string[]|any
    var subscriptions = [], object, internalCallback = (propertyName, source) => {
        return (newValue, oldValue) => {
          callback(propertyName, newValue, oldValue, source);
        }
    };

    for(var propertyName in properties) {
      object = properties[propertyName];
      subscriptions.push(
        this.observerLocator
          .getObserver(object, propertyName)
          .subscribe(internalCallback(propertyName, object)));
    }

    // return dispose function
    return () => {
      while(subscriptions.length) {
        subscriptions.pop()();
      }
    }
  }
開發者ID:luboid,項目名稱:aurelia-others-things,代碼行數:22,代碼來源:prcb-multiobserver.ts


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