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


TypeScript performance-now.default函數代碼示例

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


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

示例1: publishCodeChanges

function publishCodeChanges(): Q.Promise<string> {
    var startTime = perf();
    var endTime : number;
    var elapsedTime: number;
    var defer = Q.defer<string>();
    var selectortool = tl.createToolRunner(getTestSelectorLocation());
    selectortool.arg("PublishCodeChanges");
    selectortool.arg("/TfsTeamProjectCollection:" + tl.getVariable("System.TeamFoundationCollectionUri"));
    selectortool.arg("/ProjectId:" + tl.getVariable("System.TeamProject"));
    selectortool.arg("/newdropPath:" + tl.getVariable("Build.SourcesDirectory"));
    selectortool.arg("/Definitionid:" + tl.getVariable("System.DefinitionId"));
    selectortool.arg("/buildid:" + tl.getVariable("Build.BuildId"));
    selectortool.arg("/token:" + tl.getEndpointAuthorizationParameter("SystemVssConnection", "AccessToken", false));

    selectortool.exec()
        .then(function(code) {
            endTime = perf();
            elapsedTime = endTime - startTime;
            tl._writeLine("##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=" + elapsedTime + "]");            
            tl.debug(tl.loc("PublishCodeChangesPerfTime", elapsedTime));
            defer.resolve(String(code));
        })        
        .fail(function (err) {            
            defer.reject(err);
        });
    
    return defer.promise;
}
開發者ID:ColinDabritz,項目名稱:vsts-tasks,代碼行數:28,代碼來源:vstest.ts

示例2: perf

 .then(function(code) {
     endTime = perf();
     elapsedTime = endTime - startTime;
     tl._writeLine("##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=" + elapsedTime + "]");            
     tl.debug(tl.loc("PublishCodeChangesPerfTime", elapsedTime));
     defer.resolve(String(code));
 })        
開發者ID:ColinDabritz,項目名稱:vsts-tasks,代碼行數:7,代碼來源:vstest.ts

示例3: generateResponseFile

function generateResponseFile(): Q.Promise<string> {
    var startTime = perf();
    var endTime : number;
    var elapsedTime : number;
    var defer = Q.defer<string>();
    var tempFile = path.join(os.tmpdir(), uuid.v1() + ".txt");
    tl.debug("Response file will be generated at " + tempFile);
    var selectortool = tl.createToolRunner(getTestSelectorLocation());
    selectortool.arg("GetImpactedtests");
    selectortool.arg("/TfsTeamProjectCollection:" + tl.getVariable("System.TeamFoundationCollectionUri"));
    selectortool.arg("/ProjectId:" + tl.getVariable("System.TeamProject"));
    selectortool.arg("/buildid:" + tl.getVariable("Build.BuildId"));
    selectortool.arg("/token:" + tl.getEndpointAuthorizationParameter("SystemVssConnection", "AccessToken", false));
    selectortool.arg("/responsefile:" + tempFile);
    selectortool.exec()
        .then(function (code) {
            endTime = perf();
            elapsedTime = endTime - startTime;
            tl._writeLine("##vso[task.logissue type=warning;SubTaskName=GenerateResponseFile;SubTaskDuration=" + elapsedTime + "]");    
            tl.debug(tl.loc("GenerateResponseFilePerfTime", elapsedTime));
            defer.resolve(tempFile);
        })
        .fail(function (err) {
            defer.reject(err);
        });

    return defer.promise;
}
開發者ID:ColinDabritz,項目名稱:vsts-tasks,代碼行數:28,代碼來源:vstest.ts

示例4: processEvent

  function processEvent() {
    if (paused) {
      return;
    }

    const time = now();
    setTime(time);

    if (scheduler.isEmpty()) {
      return;
    }

    let nextEventTime = scheduler.peek().time;

    while (nextEventTime < time) {
      const eventToProcess = scheduler.shiftNextEntry();

      if (!eventToProcess.cancelled) {
        if (eventToProcess.f) {
          eventToProcess.f(eventToProcess, time, scheduler.add, currentTime);
        }

        if (eventToProcess.type === 'next') {
          eventToProcess.stream.shamefullySendNext(eventToProcess.value);
        }

        if (eventToProcess.type === 'complete') {
          eventToProcess.stream.shamefullySendComplete();
        }
      }

      nextEventTime = (scheduler.peek() && scheduler.peek().time) || Infinity;
    }
  }
開發者ID:joeldentici,項目名稱:cyclejs,代碼行數:34,代碼來源:time-driver.ts

示例5: timerPoll

 timerPoll() {
     if (this.currentTask) {
         if ((now() - this.writeTime) > this.MAX_TIME_OUT)
         { 
             this.retryCurrentTask();
         }
     }
 }
開發者ID:nodesense,項目名稱:nodesense-modbus-serial,代碼行數:8,代碼來源:modbus-serial.ts

示例6: uploadTestResults

    public uploadTestResults(tiaConfig: models.TiaConfiguration, vstestConfig: models.VsTestConfigurations, testResultsDirectory: string): number {
        const startTime = perf();
        let endTime;
        let elapsedTime;
        let definitionRunId: string;
        let resultFile: string;
        let resultFiles;
        if (!Helper.isNullOrWhitespace(testResultsDirectory)) {
            resultFiles = tl.findMatch(testResultsDirectory, path.join(testResultsDirectory, '*.trx'));
        }

        const selectortool = tl.tool(this.getTestSelectorLocation());
        selectortool.arg('UpdateTestResults');

        if (tiaConfig.context === 'CD') {
            definitionRunId = tl.getVariable('Release.ReleaseId');
        } else {
            definitionRunId = tl.getVariable('Build.BuildId');
        }

        if (resultFiles && resultFiles[0]) {
            resultFile = resultFiles[0];
        }

        let output = selectortool.execSync({
            cwd: null,
            env: {
                'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
                'projectid': tl.getVariable('System.TeamProject'),
                'definitionrunid': definitionRunId,
                'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
                'resultfile': resultFile,
                'runidfile': tiaConfig.runIdFile,
                'context': tiaConfig.context,
                'proxyurl': vstestConfig.proxyConfiguration.proxyUrl,
                'proxyusername': vstestConfig.proxyConfiguration.proxyUserName,
                'proxypassword': vstestConfig.proxyConfiguration.proxyPassword,
                'proxybypasslist': vstestConfig.proxyConfiguration.proxyBypassHosts,
                'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
                'VsTest_TaskInstanceIdentifier': vstestConfig.taskInstanceIdentifier,
                'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
                'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
                'DebugLogging': this.isDebugEnabled()
            },
            silent: null,
            outStream: null,
            errStream: null,
            windowsVerbatimArguments: null
        });

        endTime = perf();
        elapsedTime = endTime - startTime;
        console.log('##vso[task.logissue type=warning;SubTaskName=UploadTestResults;SubTaskDuration=' + elapsedTime + ']');
        tl.debug(tl.loc('UploadTestResultsPerfTime', elapsedTime));

        if (output.code !== 0) {
            tl.error(output.stderr);
        }

        tl.debug('Completed updating test results');
        return output.code;
    }
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:62,代碼來源:testselectorinvoker.ts

示例7: generateResponseFile

    public generateResponseFile(tiaConfig: models.TiaConfiguration, vstestConfig: models.VsTestConfigurations, discoveredTests: string, testCaseFilterOutputFile: string): number {
        const startTime = perf();
        let endTime: number;
        let elapsedTime: number;
        let definitionRunId: string;
        let title: string;
        let platformInput: string;
        let configurationInput: string;
        let useTestCaseFilterInResponseFile: string;
        tl.debug('Response file will be generated at ' + tiaConfig.responseFile);
        tl.debug('RunId file will be generated at ' + tiaConfig.runIdFile);

        const selectortool = tl.tool(this.getTestSelectorLocation());
        selectortool.arg('GetImpactedtests');

        if (tiaConfig.context === 'CD') {
            // Release context. Passing Release Id.
            definitionRunId = tl.getVariable('Release.ReleaseId');
        } else {
            // Build context. Passing build id.
            definitionRunId = tl.getVariable('Build.BuildId');
        }

        if (vstestConfig.buildPlatform) {
            platformInput = vstestConfig.buildPlatform;
        } else {
            platformInput = '';
        }

        if (vstestConfig.testRunTitle) {
            title = vstestConfig.testRunTitle;
        } else {
            title = '';
        }

        if (vstestConfig.buildConfig) {
            configurationInput = vstestConfig.buildConfig;
        } else {
            configurationInput = '';
        }

        if (tiaConfig.useTestCaseFilterInResponseFile && tiaConfig.useTestCaseFilterInResponseFile.toUpperCase() === 'TRUE') {
            useTestCaseFilterInResponseFile = 'true';
        } else {
            useTestCaseFilterInResponseFile = 'false';
        }

        let output = selectortool.execSync({
            cwd: null,
            env: {
                'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
                'projectid': tl.getVariable('System.TeamProject'),
                'definitionrunid': definitionRunId,
                'releaseuri': tl.getVariable('release.releaseUri'),
                'releaseenvuri': tl.getVariable('release.environmentUri'),
                'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
                'responsefilepath': tiaConfig.responseFile,
                'discoveredtestspath': discoveredTests,
                'runidfilepath': tiaConfig.runIdFile,
                'testruntitle': title,
                'baselinebuildfilepath': tiaConfig.baseLineBuildIdFile,
                'context': tiaConfig.context,
                'platform': platformInput,
                'configuration': configurationInput,
                'useTestCaseFilterInResponseFile': useTestCaseFilterInResponseFile,
                'testCaseFilterOutputFile': testCaseFilterOutputFile ? testCaseFilterOutputFile : "",
                'isCustomEngineEnabled': String(!Helper.isNullOrWhitespace(tiaConfig.userMapFile)),
                'proxyurl': vstestConfig.proxyConfiguration.proxyUrl,
                'proxyusername': vstestConfig.proxyConfiguration.proxyUserName,
                'proxypassword': vstestConfig.proxyConfiguration.proxyPassword,
                'proxybypasslist': vstestConfig.proxyConfiguration.proxyBypassHosts,
                'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
                'VsTest_TaskInstanceIdentifier': vstestConfig.taskInstanceIdentifier,
                'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
                'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
                'DebugLogging': this.isDebugEnabled()
            },
            silent: null,
            outStream: null,
            errStream: null,
            windowsVerbatimArguments: null
        });

        endTime = perf();
        elapsedTime = endTime - startTime;
        console.log('##vso[task.logissue type=warning;SubTaskName=GetImpactedTests;SubTaskDuration=' + elapsedTime + ']');
        tl.debug(tl.loc('GenerateResponseFilePerfTime', elapsedTime));

        if (output.code !== 0) {
            tl.error(output.stderr);
        }

        tl.debug('completed publish code changes');
        return output.code;
    }
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:95,代碼來源:testselectorinvoker.ts

示例8: publishCodeChanges

    public publishCodeChanges(tiaConfig: models.TiaConfiguration, proxyConfig: models.ProxyConfiguration, testCaseFilterFile: string, taskInstanceIdentifier: string): number {
        tl.debug('Entered publish code changes');

        const startTime = perf();
        let endTime: number;
        let elapsedTime: number;
        let pathFilters: string;
        let definitionRunId: string;
        let definitionId: string;
        let prFlow: string;
        let rebaseLimit: string;
        let sourcesDirectory: string;

        let newprovider = 'true';
        if (this.getTIALevel(tiaConfig) === 'method') {
            newprovider = 'false';
        }

        const selectortool = tl.tool(this.getTestSelectorLocation());
        selectortool.arg('PublishCodeChanges');

        if (tiaConfig.context === 'CD') {
            // Release context. Passing Release Id.
            definitionRunId = tl.getVariable('Release.ReleaseId');
            definitionId = tl.getVariable('release.DefinitionId');
        } else {
            // Build context. Passing build id.
            definitionRunId = tl.getVariable('Build.BuildId');
            definitionId = tl.getVariable('System.DefinitionId');
        }

        if (tiaConfig.isPrFlow && tiaConfig.isPrFlow.toUpperCase() === 'TRUE') {
            prFlow = 'true';
        } else {
            prFlow = 'false';
        }

        if (tiaConfig.tiaRebaseLimit) {
            rebaseLimit = tiaConfig.tiaRebaseLimit;
        }

        if (typeof tiaConfig.tiaFilterPaths !== 'undefined') {
            pathFilters = tiaConfig.tiaFilterPaths.trim();
        } else {
            pathFilters = '';
        }

        if (typeof tiaConfig.sourcesDir !== 'undefined') {
            sourcesDirectory = tiaConfig.sourcesDir.trim();
        } else {
            sourcesDirectory = '';
        }

        let output = selectortool.execSync({
            cwd: null,
            env: {
                'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
                'projectid': tl.getVariable('System.TeamProject'),
                'definitionrunid': definitionRunId,
                'definitionid': definitionId,
                'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
                'sourcesdir': sourcesDirectory,
                'newprovider': newprovider,
                'prflow': prFlow,
                'rebaselimit': rebaseLimit,
                'baselinefile': tiaConfig.baseLineBuildIdFile,
                'context': tiaConfig.context,
                'filter': pathFilters,
                'userMapFile': tiaConfig.userMapFile ? tiaConfig.userMapFile : '',
                'testCaseFilterResponseFile': testCaseFilterFile ? testCaseFilterFile : '',
                'proxyurl': proxyConfig.proxyUrl,
                'proxyusername': proxyConfig.proxyUserName,
                'proxypassword': proxyConfig.proxyPassword,
                'proxybypasslist': proxyConfig.proxyBypassHosts,
                'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
                'VsTest_TaskInstanceIdentifier': taskInstanceIdentifier,
                'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
                'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
                'DebugLogging': this.isDebugEnabled()
            },
            silent: null,
            outStream: null,
            errStream: null,
            windowsVerbatimArguments: null
        });

        endTime = perf();
        elapsedTime = endTime - startTime;
        console.log('##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=' + elapsedTime + ']');
        tl.debug(tl.loc('PublishCodeChangesPerfTime', elapsedTime));

        if (output.code !== 0) {
            tl.warning(output.stderr);
        }

        tl.debug('completed publish code changes');
        return output.code;
    }
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:98,代碼來源:testselectorinvoker.ts

示例9: publishCodeChangesInDistributedMode

    public publishCodeChangesInDistributedMode(inputDataContract: inputdatacontract.InputDataContract): number {
        tl.debug('Entered publish code changes');

        const startTime = perf();
        let endTime: number;
        let elapsedTime: number;
        let pathFilters: string;
        let definitionRunId: string;
        let definitionId: string;
        let prFlow: string;
        let rebaseLimit: string;
        let sourcesDirectory: string;
        let context: string;

        let newprovider = 'true';
        if (!inputDataContract.ExecutionSettings.TiaSettings.FileLevel) {
            newprovider = 'false';
        }

        const selectortool = tl.tool(this.getTestSelectorLocation());
        selectortool.arg('PublishCodeChanges');

        if (tl.getVariable('release.releaseUri')) {
            // Release context. Passing Release Id.
            context = 'CD';
            definitionRunId = tl.getVariable('Release.ReleaseId');
            definitionId = tl.getVariable('release.DefinitionId');
        } else {
            // Build context. Passing build id.
            context = 'CI';
            definitionRunId = tl.getVariable('Build.BuildId');
            definitionId = tl.getVariable('System.DefinitionId');
        }

        if (inputDataContract.ExecutionSettings.TiaSettings.IsPrFlow) {
            prFlow = 'true';
        } else {
            prFlow = 'false';
        }

        //hydra: check if this conversion works fine (number to string)
        if (inputDataContract.ExecutionSettings.TiaSettings.RebaseLimit) {
            rebaseLimit = inputDataContract.ExecutionSettings.TiaSettings.RebaseLimit.toString();
        }

        if (inputDataContract.ExecutionSettings.TiaSettings.FilterPaths) {
            pathFilters = inputDataContract.ExecutionSettings.TiaSettings.FilterPaths.trim();
        } else {
            pathFilters = '';
        }

        if (inputDataContract.ExecutionSettings.TiaSettings.SourcesDirectory) {
            sourcesDirectory = inputDataContract.ExecutionSettings.TiaSettings.SourcesDirectory.trim();
        } else {
            sourcesDirectory = '';
        }

        const output = selectortool.execSync({
            cwd: null,
            env: {
                'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
                'projectid': tl.getVariable('System.TeamProject'),
                'definitionrunid': definitionRunId,
                'definitionid': definitionId,
                'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
                'sourcesdir': sourcesDirectory,
                'newprovider': newprovider,
                'prflow': prFlow,
                'rebaselimit': rebaseLimit,
                'baselinefile': inputDataContract.TiaBaseLineBuildIdFile,
                'context': context,
                'filter': pathFilters,
                'userMapFile': inputDataContract.ExecutionSettings.TiaSettings.UserMapFile ? inputDataContract.ExecutionSettings.TiaSettings.UserMapFile : '',
                'testCaseFilterResponseFile': '',
                'proxyurl': inputDataContract.ProxySettings.ProxyUrl,
                'proxyusername': inputDataContract.ProxySettings.ProxyUsername,
                'proxypassword': inputDataContract.ProxySettings.ProxyPassword,
                'proxybypasslist': inputDataContract.ProxySettings.ProxyBypassHosts,
                'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
                'VsTest_TaskInstanceIdentifier': uuid.v1(),
                'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
                'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
                'DebugLogging': this.isDebugEnabled()
            },
            silent: null,
            outStream: null,
            errStream: null,
            windowsVerbatimArguments: null
        });

        endTime = perf();
        elapsedTime = endTime - startTime;
        console.log('##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=' + elapsedTime + ']');
        tl.debug(tl.loc('PublishCodeChangesPerfTime', elapsedTime));

        if (output.code !== 0) {
            tl.warning(output.stderr);
        }

        tl.debug('completed publish code changes');
//.........這裏部分代碼省略.........
開發者ID:bleissem,項目名稱:vsts-tasks,代碼行數:101,代碼來源:testselectorinvoker.ts


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