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


TypeScript uuid.generateUuid函數代碼示例

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


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

示例1: test

	test('rimraf - simple', function () {
		const id = uuid.generateUuid();
		const parentDir = path.join(os.tmpdir(), 'vsctests', id);
		const newDir = path.join(parentDir, 'extfs', id);

		return pfs.mkdirp(newDir, 493).then(() => {
			fs.writeFileSync(path.join(newDir, 'somefile.txt'), 'Contents');
			fs.writeFileSync(path.join(newDir, 'someOtherFile.txt'), 'Contents');

			return pfs.rimraf(newDir).then(() => {
				assert.ok(!fs.existsSync(newDir));
			});
		});
	});
開發者ID:AllureFer,項目名稱:vscode,代碼行數:14,代碼來源:pfs.test.ts

示例2: test

	test('convert keybinding with title to entry', () => {
		const expected = aResolvedKeybindingItem({ command: 'a' + uuid.generateUuid(), firstPart: { keyCode: KeyCode.Escape }, when: 'context1 && context2' });
		prepareKeybindingService(expected);
		registerCommandWithTitle(expected.command, 'Some Title');

		return testObject.resolve({}).then(() => {
			const actual = testObject.fetch('')[0];
			assert.equal(actual.keybindingItem.command, expected.command);
			assert.equal(actual.keybindingItem.commandLabel, 'Some Title');
			assert.equal(actual.keybindingItem.commandDefaultLabel, null);
			assert.equal(actual.keybindingItem.keybinding.getAriaLabel(), expected.resolvedKeybinding.getAriaLabel());
			assert.equal(actual.keybindingItem.when, expected.when.serialize());
		});
	});
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:14,代碼來源:keybindingsEditorModel.test.ts

示例3: resolve

	return new TPromise<string>(resolve => {
		try {
			getmac.getMac((error, macAddress) => {
				if (!error) {
					resolve(crypto.createHash('sha256').update(macAddress, 'utf8').digest('hex'));
				} else {
					resolve(uuid.generateUuid()); // fallback, generate a UUID
				}
			});
		} catch (err) {
			errors.onUnexpectedError(err);
			resolve(uuid.generateUuid()); // fallback, generate a UUID
		}
	});
開發者ID:asotog,項目名稱:vscode,代碼行數:14,代碼來源:id.ts

示例4: constructor

	constructor(id: string, name: string, fullPath: string, isFile: boolean, isExpanded: boolean, ownerUri: string, parent:FileNode) {
		if (id) {
			this.id = id;
		} else {
			this.id = generateUuid();
		}

		this.name = name;
		this.fullPath = fullPath;
		this.isFile = isFile;
		this.ownerUri = ownerUri;
		this.isExpanded = isExpanded;
		this.parent = parent;
	}
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:14,代碼來源:fileNode.ts

示例5: resolveCommonProperties

export function resolveCommonProperties(commit: string, version: string, machineId: string, installSourcePath: string): TPromise<{ [name: string]: string; }> {
	const result: { [name: string]: string; } = Object.create(null);
	// __GDPR__COMMON__ "common.machineId" : { "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
	result['common.machineId'] = machineId;
	// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['sessionID'] = uuid.generateUuid() + Date.now();
	// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['commitHash'] = commit;
	// __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['version'] = version;
	// __GDPR__COMMON__ "common.osVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['common.osVersion'] = os.release();
	// __GDPR__COMMON__ "common.platform" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['common.platform'] = Platform.Platform[Platform.platform];
	// __GDPR__COMMON__ "common.nodePlatform" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['common.nodePlatform'] = process.platform;
	// __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
	result['common.nodeArch'] = process.arch;

	// dynamic properties which value differs on each call
	let seq = 0;
	const startTime = Date.now();
	Object.defineProperties(result, {
		// __GDPR__COMMON__ "timestamp" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
		'timestamp': {
			get: () => new Date(),
			enumerable: true
		},
		// __GDPR__COMMON__ "common.timesincesessionstart" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
		'common.timesincesessionstart': {
			get: () => Date.now() - startTime,
			enumerable: true
		},
		// __GDPR__COMMON__ "common.sequence" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
		'common.sequence': {
			get: () => seq++,
			enumerable: true
		}
	});

	return readFile(installSourcePath, 'utf8').then(contents => {

		// __GDPR__COMMON__ "common.source" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
		result['common.source'] = contents.slice(0, 30);

		return result;
	}, error => {
		return result;
	});
}
開發者ID:servicesgpr,項目名稱:vscode,代碼行數:50,代碼來源:commonProperties.ts

示例6: constructor

	constructor(private _args: ParsedArgs, private _execPath: string) {
		const machineIdPath = path.join(this.userDataPath, 'machineid');

		try {
			this.machineUUID = fs.readFileSync(machineIdPath, 'utf8');
		} catch (err) {
			this.machineUUID = generateUuid();

			try {
				fs.writeFileSync(machineIdPath, this.machineUUID);
			} catch (err) {
				console.warn('Could not store machine ID');
			}
		}
	}
開發者ID:kieferrm,項目名稱:vscode,代碼行數:15,代碼來源:environmentService.ts

示例7: fromSingle

	function fromSingle(problemMatcher: vscode.ProblemMatcher): Problems.ProblemMatcher {
		if (problemMatcher === void 0 || problemMatcher === null) {
			return undefined;
		}

		let location = FileLocation.from(problemMatcher.fileLocation);
		let result: Problems.ProblemMatcher = {
			owner: typeof problemMatcher.owner === 'string' ? problemMatcher.owner : UUID.generateUuid(),
			applyTo: ApplyTo.from(problemMatcher.applyTo),
			fileLocation: location.kind,
			filePrefix: location.prefix,
			pattern: ProblemPattern.from(problemMatcher.pattern),
			severity: fromDiagnosticSeverity(problemMatcher.severity),
		};
		return result;
	}
開發者ID:jhasse,項目名稱:vscode,代碼行數:16,代碼來源:extHostTask.ts

示例8: setUpWorkspace

function setUpWorkspace(folders: string[]): TPromise<{ parentDir: string, configPath: string }> {

	const id = uuid.generateUuid();
	const parentDir = path.join(os.tmpdir(), 'vsctests', id);

	return pfs.mkdirp(parentDir, 493)
		.then(() => {
			const configPath = path.join(parentDir, 'vsctests.code-workspace');
			const workspace = { folders: folders.map(path => ({ path })) };
			fs.writeFileSync(configPath, JSON.stringify(workspace, null, '\t'));

			return TPromise.join(folders.map(folder => setUpFolder(folder, parentDir)))
				.then(() => ({ parentDir, configPath }));
		});

}
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:16,代碼來源:configurationService.test.ts


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