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