本文整理汇总了TypeScript中vs/platform/storage/common/storage.IStorageService.store方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IStorageService.store方法的具体用法?TypeScript IStorageService.store怎么用?TypeScript IStorageService.store使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/platform/storage/common/storage.IStorageService
的用法示例。
在下文中一共展示了IStorageService.store方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getGloballyDisabledExtensions
export function getGloballyDisabledExtensions(extensionEnablementService: IExtensionEnablementService, storageService: IStorageService, installedExtensions: { id: string; }[]) {
const globallyDisabled = extensionEnablementService.getGloballyDisabledExtensions();
if (!storageService.getBoolean(BetterMergeCheckKey, StorageScope.GLOBAL, false)) {
storageService.store(BetterMergeCheckKey, true);
if (globallyDisabled.every(disabled => disabled.id !== BetterMergeId) && installedExtensions.some(d => d.id === BetterMergeId)) {
globallyDisabled.push({ id: BetterMergeId });
extensionEnablementService.setEnablement({ id: BetterMergeId }, false);
storageService.store(BetterMergeDisabledNowKey, true);
}
}
return globallyDisabled;
}
示例2: loadExperiments
export function loadExperiments(contextService: IWorkspaceContextService, storageService: IStorageService, configurationService: IConfigurationService): ITelemetryExperiments {
const key = 'experiments.randomness';
let valueString = storageService.get(key);
if (!valueString) {
valueString = Math.random().toString();
storageService.store(key, valueString);
}
const random1 = parseFloat(valueString);
let [random2, showNewUserWatermark] = splitRandom(random1);
let [random3, openUntitledFile] = splitRandom(random2);
let [, openGettingStarted] = splitRandom(random3);
const newUserDuration = 24 * 60 * 60 * 1000;
const firstSessionDate = storageService.get('telemetry.firstSessionDate');
const isNewUser = !firstSessionDate || Date.now() - Date.parse(firstSessionDate) < newUserDuration;
if (!isNewUser || contextService.hasWorkspace()) {
showNewUserWatermark = defaultExperiments.showNewUserWatermark;
openUntitledFile = defaultExperiments.openUntitledFile;
}
const isNewSession = !storageService.get('telemetry.lastSessionDate');
const now = Date.now();
if (!(isNewSession && now >= beginGettingStartedExp && now < endGettingStartedExp)) {
openGettingStarted = undefined;
}
return applyOverrides(configurationService, {
showNewUserWatermark,
openUntitledFile,
openGettingStarted
});
}
示例3: loadExperiments
export function loadExperiments(storageService: IStorageService, configurationService: IConfigurationService): ITelemetryExperiments {
const key = 'experiments.randomness';
let valueString = storageService.get(key);
if (!valueString) {
valueString = Math.random().toString();
storageService.store(key, valueString);
}
const random0 = parseFloat(valueString);
let [random1, showDefaultViewlet] = splitRandom(random0);
const [random2, showCommandsWatermark] = splitRandom(random1);
let [, openUntitledFile] = splitRandom(random2);
// is the user a first time user?
let isNewSession = storageService.get('telemetry.lastSessionDate') ? false : true;
if (!isNewSession) {
// for returning users we fall back to the default configuration for the sidebar and the initially opened, empty editor
showDefaultViewlet = defaultExperiments.showDefaultViewlet;
openUntitledFile = defaultExperiments.openUntitledFile;
}
return applyOverrides(configurationService, {
showDefaultViewlet,
showCommandsWatermark,
openUntitledFile
});
}
示例4: test
test('lastSessionDate when aviablale', async function () {
nestStorage2Service.store('telemetry.lastSessionDate', new Date().toUTCString(), StorageScope.GLOBAL);
const props = await resolveWorkbenchCommonProperties(nestStorage2Service, commit, version, 'someMachineId', installSource);
assert.ok('common.lastSessionDate' in props); // conditional, see below
assert.ok('common.isNewSession' in props);
assert.equal(props['common.isNewSession'], 0);
});
示例5: getExperimentsRandomness
function getExperimentsRandomness(storageService: IStorageService) {
const key = 'experiments.randomness';
let valueString = storageService.get(key);
if (!valueString) {
valueString = Math.random().toString();
storageService.store(key, valueString);
}
return parseFloat(valueString);
}
示例6: loadExperiments
export function loadExperiments(storageService: IStorageService, configurationService: IConfigurationService): ITelemetryExperiments {
const key = 'experiments.randomness';
let valueString = storageService.get(key);
if (!valueString) {
valueString = Math.random().toString();
storageService.store(key, valueString);
}
const random0 = parseFloat(valueString);
const [random1, showDefaultViewlet] = splitRandom(random0);
const [random2, showCommandsWatermark] = splitRandom(random1);
const [, openUntitledFile] = splitRandom(random2);
return applyOverrides(configurationService, {
showDefaultViewlet,
showCommandsWatermark,
openUntitledFile
});
}