本文整理汇总了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;
}
示例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');
}