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


TypeScript os.release函數代碼示例

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


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

示例1:

////////////////////////////////////////////////////
/// os tests : https://nodejs.org/api/os.html
////////////////////////////////////////////////////

namespace os_tests {
    {
        let result: string;

        result = os.tmpdir();
        result = os.homedir();
        result = os.endianness();
        result = os.hostname();
        result = os.type();
        result = os.platform();
        result = os.arch();
        result = os.release();
        result = os.EOL;
    }

    {
        let result: number;

        result = os.uptime();
        result = os.totalmem();
        result = os.freemem();
    }

    {
        let result: number[];

        result = os.loadavg();
開發者ID:hongshanzhu,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:node-tests.ts

示例2: computeStartupMetrics

	public computeStartupMetrics(): void {
		const now = Date.now();
		const initialStartup = !!this.isInitialStartup;
		const start = initialStartup ? this.start : this.windowLoad;

		let totalmem: number;
		let freemem: number;
		let cpus: { count: number; speed: number; model: string; };
		let platform: string;
		let release: string;
		let loadavg: number[];
		let meminfo: IMemoryInfo;
		let isVMLikelyhood: number;

		try {
			totalmem = os.totalmem();
			freemem = os.freemem();
			platform = os.platform();
			release = os.release();
			loadavg = os.loadavg();
			meminfo = process.getProcessMemoryInfo();

			isVMLikelyhood = Math.round((virtualMachineHint.value() * 100));

			const rawCpus = os.cpus();
			if (rawCpus && rawCpus.length > 0) {
				cpus = { count: rawCpus.length, speed: rawCpus[0].speed, model: rawCpus[0].model };
			}
		} catch (error) {
			console.error(error); // be on the safe side with these hardware method calls
		}

		this._startupMetrics = {
			version: 1,
			ellapsed: Math.round(this.workbenchStarted.getTime() - start.getTime()),
			timers: {
				ellapsedExtensions: Math.round(this.afterExtensionLoad.getTime() - this.beforeExtensionLoad.getTime()),
				ellapsedExtensionsReady: Math.round(this.afterExtensionLoad.getTime() - start.getTime()),
				ellapsedRequire: Math.round(this.afterLoadWorkbenchMain.getTime() - this.beforeLoadWorkbenchMain.getTime()),
				ellapsedViewletRestore: Math.round(this.restoreViewletDuration),
				ellapsedEditorRestore: Math.round(this.restoreEditorsDuration),
				ellapsedWorkbench: Math.round(this.workbenchStarted.getTime() - this.beforeWorkbenchOpen.getTime()),
				ellapsedWindowLoadToRequire: Math.round(this.beforeLoadWorkbenchMain.getTime() - this.windowLoad.getTime()),
				ellapsedTimersToTimersComputed: Date.now() - now
			},
			platform,
			release,
			totalmem,
			freemem,
			meminfo,
			cpus,
			loadavg,
			initialStartup,
			isVMLikelyhood,
			hasAccessibilitySupport: !!this.hasAccessibilitySupport,
			emptyWorkbench: this.isEmptyWorkbench
		};

		if (initialStartup) {
			this._startupMetrics.timers.ellapsedAppReady = Math.round(this.appReady.getTime() - this.start.getTime());
			this._startupMetrics.timers.ellapsedWindowLoad = Math.round(this.windowLoad.getTime() - this.appReady.getTime());
		}
	}
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:63,代碼來源:timerService.ts

示例3: parseFloat

			'description': nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if Windows is using a high contrast theme, and to dark theme when switching away from a Windows high contrast theme."),
			'included': isWindows
		},
		'window.titleBarStyle': {
			'type': 'string',
			'enum': ['native', 'custom'],
			'default': isLinux ? 'native' : 'custom',
			'scope': ConfigurationScope.APPLICATION,
			'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply.")
		},
		'window.nativeTabs': {
			'type': 'boolean',
			'default': false,
			'scope': ConfigurationScope.APPLICATION,
			'description': nls.localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured."),
			'included': isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
		},
		'window.nativeFullscreen': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('window.nativeFullscreen', "Prefer native full-screen. Disable this option to prevent macOS from creating a new space when going full-screen."),
			'included': isMacintosh
		},
		'window.clickThroughInactive': {
			'type': 'boolean',
			'default': true,
			'scope': ConfigurationScope.APPLICATION,
			'description': nls.localize('window.clickThroughInactive', "If enabled, clicking on an inactive window will both activate the window and trigger the element under the mouse if it is clickable. If disabled, clicking anywhere on an inactive window will activate it only and a second click is required on the element."),
			'included': isMacintosh
		}
	}
開發者ID:felipecaputo,項目名稱:vscode,代碼行數:31,代碼來源:main.contribution.ts

示例4: LanguageManager

import { GlobalContainer } from "./models";
import { LanguageManager } from "./lib/language-manager";
import * as os from 'os';

export const languageManager = new LanguageManager();

export const APP: GlobalContainer = {
    lang: languageManager.getLanguage('English'),
    version: require('../package.json')['version'],
    os: require('os-name')(os.platform(), os.release()), 
    arch: os.arch()
};
開發者ID:kencinder,項目名稱:steam-rom-manager,代碼行數:12,代碼來源:variables.ts


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