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


TypeScript Common.updateTableRecords方法代碼示例

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


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

示例1: showProblems

 export function showProblems(): boolean {
    var problemRecords = [];
    var problemIndex = 1;
    
    for (var problemKey in currentProblems) {
       if (currentProblems.hasOwnProperty(problemKey)) {
          var problemItem: ProblemItem = currentProblems[problemKey];
          
       	if(problemItem != null) {
       	   problemRecords.push({ 
       	      recid: problemIndex++,
       		   line: problemItem.getLine(),
       		   location: "Line " + problemItem.getLine(), 
                resource: problemItem.getResourcePath().getFilePath(), // /blah/file.snap 
                description: problemItem.getMessage(), 
                project: problemItem.getProject(), 
                script: problemItem.getResourcePath().getResourcePath() // /resource/<project>/blah/file.snap
             });
       	}
       }
    }
    if(Common.updateTableRecords(problemRecords, 'problems')) {
       highlightProblems(); // highlight them also      
       Project.showProblemsTab(); // focus the problems tab
       return true;
    }
    return false;
 }
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:28,代碼來源:problem.ts

示例2: updateProfiler

   function updateProfiler(socket, type, text) {
      var profileResult = JSON.parse(text);
      var profileRecords = profileResult.results;
      var profilerRecords = [];
      var profilerWidths = [];
      var profilerIndex = 1;
      var totalTime = 0;
      var currentHeight = w2ui['profiler'].records;
     
      for(var i = 0; i < profileRecords.length; i++) {
         totalTime += profileRecords[i].time;
      }
      for(var i = 0; i < profileRecords.length; i++) {
         var recordTime = profileRecords[i].time;
         
         if(recordTime > 0) {
            var percentageTime: number = (recordTime/totalTime)*100;
            var percentage: number = percentageTime;
            
            profilerWidths[i] = percentage;
         }
      }
      for(var i = 0; i < profileRecords.length; i++) {
         var profileRecord = profileRecords[i];
         var sortableProfilerWidth = ('0000'+ profilerWidths[i]).slice(-4); // padd with leading zeros
         var resourcePath: FilePath = FileTree.createResourcePath(profileRecord.resource);
         var displayName = "<div class='profilerRecord'>"+resourcePath.getProjectPath()+"</div>";
         var percentageBar = "<!-- " + sortableProfilerWidth + " --><div style='padding: 2px;'><div style='height: 10px; background: #ed6761; width: "+profilerWidths[i]+"%;'></div></div>";
         var averageTime = (profileRecord.time / profileRecord.count) / 1000; // average time in seconds

         profilerRecords.push({
            recid: profilerIndex++,
            resource: displayName,
            percentage: percentageBar,
            duration: profileRecord.time,
            line: profileRecord.line,
            count: profileRecord.count,
            average: averageTime.toFixed(5),
            script: resourcePath.getResourcePath()
         });
      }
      Common.updateTableRecords(profilerRecords, 'profiler');
   }
開發者ID:snapscript,項目名稱:snap-develop,代碼行數:43,代碼來源:profiler.ts


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