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


TypeScript aurelia-framework.computedFrom函數代碼示例

本文整理匯總了TypeScript中aurelia-framework.computedFrom函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript computedFrom函數的具體用法?TypeScript computedFrom怎麽用?TypeScript computedFrom使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: timeScaleData

    @computedFrom('data', 'pump')
    get timeScaleData(): chartjs.LinearChartData {

        let lastPoint: DataPoint;
        let currentArray = [];
        let groups = new Array<DataPoint[]>();

        for (var pt of this.data) {
            if (lastPoint != null && lastPoint.pumpRunning != pt.pumpRunning) {
                groups.push(currentArray);
                currentArray = [];
           }
            currentArray.push(pt);
            lastPoint = pt;
        }
        groups.push(currentArray);

        return {
            datasets: groups.map(arr => {
                return {
                    data: arr.map(point => {
                        return {
                            x: point.timeStamp,
                            y: point.waterLevel
                        };
                    }),
                    borderColor: arr[0].pumpRunning ? 'Green' : 'Red'
                };
            })
        };
    }
開發者ID:NickSchweitzer,項目名稱:SumpPumpMonitor,代碼行數:31,代碼來源:pumpdetail.ts

示例2: value

    @computedFrom('job')
    get value():string {
        if(!Array.isArray(this.job.jobPhases)) return JobPhaseStatuses.NOT_STARTED;
        const phase = this.job.jobPhases.find(p => p.phase._id === this.phase._id);
        if(!phase) return JobPhaseStatuses.NOT_STARTED;

        return phase.status;
    }
開發者ID:Resounding,項目名稱:Jobs-Web,代碼行數:8,代碼來源:table-cell.ts

示例3: title

    @computedFrom('entity.id', 'entity.name')
    get title() {
        if (this.entity.id <= 0) {
            return "New Application";
        }

        return `Application #${this.entity.id}`;
    }
開發者ID:t0ms3n,項目名稱:SoftwareManager,代碼行數:8,代碼來源:application.ts

示例4: style

    @computedFrom("imageWidth", "imageHeight")
    public get style(): string {

        return `
            min-height: ${this.maxHeight}px;
            height: ${this.maxHeight}px;
        `;
    }
開發者ID:benlaan,項目名稱:aurelia-bootstrap-plugin,代碼行數:8,代碼來源:bs-thumbnail.ts

示例5: items

    @computedFrom("pageCount", "maxDisplayCount")
    public get items(): Array<string> {

        if (this._items != null && this.pageCount && this.maxDisplayCount)
            return this._items;

        this._items = this.calculateItems();
        return this._items;
    }
開發者ID:benlaan,項目名稱:aurelia-bootstrap-plugin,代碼行數:9,代碼來源:bs-pagination.ts

示例6: body

 /**
  * @returns body, will lazy load from the web service if the body has not been
  *          loaded as of yet, note if it has not been loaded yet it will return null
  *          the first time.
  */
 @computedFrom('_body')
 get body() : string {
     if(this._body == null){
         this.client.fetch(`posts/${this.date}/${this._title}`)
             .then(r => r.text())
             .then(html => {
                 this._body = html
             });
     }
     
     return this._body;
 }
開發者ID:cjdibbs,項目名稱:Blog,代碼行數:17,代碼來源:post.ts

示例7: timeScaleOptions

 @computedFrom('data')
 get timeScaleOptions(): chartjs.ChartOptions {
     return {
         scales: {
             xAxes: [{
                 type: 'time',
                 time: {
                     minUnit: 'second',
                     tooltipFormat: "h:mm:ss a MM-DD-YYYY",
                     max: this.data[0].timeStamp,
                     min: this.data[this.data.length - 1].timeStamp
                 }
             }]
         },
         legend: {
             display: false
         }
     };
 }
開發者ID:NickSchweitzer,項目名稱:SumpPumpMonitor,代碼行數:19,代碼來源:pumpdetail.ts

示例8: fullName

 @computedFrom("firstName", "lastName")
 get fullName() { return this.firstName + " " + this.lastName;  }
開發者ID:rajajhansi,項目名稱:communityapp-aurelia-tswebpack,代碼行數:2,代碼來源:sponsors.ts

示例9: isSubTitleDisplayed

 @computedFrom('showsubtitle')
 get isSubTitleDisplayed(){
     return this.showsubtitle == 'true';
 }
開發者ID:richardnagle,項目名稱:buildjs,代碼行數:4,代碼來源:team-banner.ts

示例10: hasAny

 @computedFrom('mediaQueueViewModels')
 get hasAny(): boolean {
   return this.mediaQueueViewModels.length > 0;
 }
開發者ID:sebthieti,項目名稱:jogplayer-online,代碼行數:4,代碼來源:mediaQueue.ts


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