提交 d1e6b2e4 编写于 作者: B Benjamin Pasero

polish & cleanup

上级 05a6bbb3
......@@ -137,7 +137,7 @@ export class MessageList {
id: id,
text: message,
severity: severity,
time: new Date().getTime(),
time: Date.now(),
actions: (<IMessageWithAction>id).actions
});
......
......@@ -91,7 +91,7 @@ export class ResourceViewer {
.empty()
.style({ paddingLeft: '20px' }) // restore CSS value in case the user saw a PDF before where we remove padding
.img({
src: resource.toString() + '?' + new Date().getTime() // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
src: resource.toString() + '?' + Date.now() // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
}).on(DOM.EventType.LOAD, () => {
if (scrollbar) {
scrollbar.scanDomNode();
......@@ -106,7 +106,7 @@ export class ResourceViewer {
.style({ padding: 0, margin: 0 }) // We really do not want any paddings or margins when displaying PDFs
.element('object')
.attr({
data: resource.toString() + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
data: resource.toString() + '?' + Date.now(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
width: '100%',
height: '100%',
type: mime
......@@ -120,7 +120,7 @@ export class ResourceViewer {
.style({ paddingLeft: '20px' }) // restore CSS value in case the user saw a PDF before where we remove padding
.element('audio')
.attr({
src: resource.toString() + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
src: resource.toString() + '?' + Date.now(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
text: nls.localize('missingAudioSupport', "Sorry but playback of audio files is not supported."),
controls: 'controls'
}).on(DOM.EventType.LOAD, () => {
......@@ -137,7 +137,7 @@ export class ResourceViewer {
.style({ paddingLeft: '20px' }) // restore CSS value in case the user saw a PDF before where we remove padding
.element('video')
.attr({
src: resource.toString() + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
src: resource.toString() + '?' + Date.now(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique
text: nls.localize('missingVideoSupport', "Sorry but playback of video files is not supported."),
controls: 'controls'
}).on(DOM.EventType.LOAD, () => {
......
......@@ -18,7 +18,7 @@ import { download, json } from 'vs/base/node/request';
import { getProxyAgent } from 'vs/base/node/proxy';
import { ISettingsService } from 'vs/code/electron-main/settings';
import { ILifecycleService } from 'vs/code/electron-main/lifecycle';
import { IEnvironmentService } from './env';
import { IEnvironmentService } from 'vs/code/electron-main/env';
export interface IUpdate {
url: string;
......
......@@ -10,7 +10,7 @@ import { IWindowsService } from 'vs/code/electron-main/windows';
import { VSCodeWindow } from 'vs/code/electron-main/window';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { ILogService } from './log';
import { ILogService } from 'vs/code/electron-main/log';
export interface ILaunchService {
start(args: ICommandLineArguments, userEnv: IProcessEnvironment): TPromise<void>;
......
......@@ -6,7 +6,7 @@
'use strict';
import { ServiceIdentifier, createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IEnvironmentService } from './env';
import { IEnvironmentService } from 'vs/code/electron-main/env';
export const ILogService = createDecorator<ILogService>('logService');
......
......@@ -29,8 +29,8 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ILogService, MainLogService } from './log';
import { IStorageService, StorageService } from './storage';
import { ILogService, MainLogService } from 'vs/code/electron-main/log';
import { IStorageService, StorageService } from 'vs/code/electron-main/storage';
function quit(accessor: ServicesAccessor, error?: Error);
function quit(accessor: ServicesAccessor, message?: string);
......
......@@ -12,7 +12,7 @@ import { IStorageService } from 'vs/code/electron-main/storage';
import { shell, screen, BrowserWindow } from 'electron';
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
import { ICommandLineArguments, IEnvironmentService, IProcessEnvironment } from 'vs/code/electron-main/env';
import { ILogService } from './log';
import { ILogService } from 'vs/code/electron-main/log';
export interface IWindowState {
width?: number;
......@@ -171,7 +171,7 @@ export class VSCodeWindow {
const usesLightTheme = /vs($| )/.test(this.storageService.getItem<string>(VSCodeWindow.themeStorageKey));
let showDirectly = true; // set to false to prevent background color flash (flash should be fixed for Electron >= 0.37.x)
if (showDirectly && !global.windowShow) {
global.windowShow = new Date().getTime();
global.windowShow = Date.now();
}
let options: Electron.BrowserWindowOptions = {
......@@ -206,7 +206,7 @@ export class VSCodeWindow {
}
if (showDirectly) {
this._lastFocusTime = new Date().getTime(); // since we show directly, we need to set the last focus time too
this._lastFocusTime = Date.now(); // since we show directly, we need to set the last focus time too
}
if (this.storageService.getItem<boolean>(VSCodeWindow.menuBarHiddenKey, false)) {
......@@ -300,7 +300,7 @@ export class VSCodeWindow {
// To prevent flashing, we set the window visible after the page has finished to load but before VSCode is loaded
if (!this.win.isVisible()) {
if (!global.windowShow) {
global.windowShow = new Date().getTime();
global.windowShow = Date.now();
}
if (this.currentWindowMode === WindowMode.Maximized) {
......@@ -336,7 +336,7 @@ export class VSCodeWindow {
// Window Focus
this._win.on('focus', () => {
this._lastFocusTime = new Date().getTime();
this._lastFocusTime = Date.now();
});
// Window Failed to load
......
......@@ -388,7 +388,7 @@ export class WorkbenchShell {
return;
}
let now = new Date().getTime();
let now = Date.now();
if (errorMsg === this.previousErrorValue && now - this.previousErrorTime <= 1000) {
return; // Return if error message identical to previous and shorter than 1 second
}
......
......@@ -163,7 +163,7 @@ export class FileTracker implements IWorkbenchContribution {
return false;
}
if (new Date().getTime() - model.getLastDirtyTime() < FileTracker.FILE_CHANGE_UPDATE_DELAY) {
if (Date.now() - model.getLastDirtyTime() < FileTracker.FILE_CHANGE_UPDATE_DELAY) {
return false; // this is a weak check to see if the change came from outside the editor or not
}
......@@ -199,7 +199,7 @@ export class FileTracker implements IWorkbenchContribution {
let lastDirtyTime = textModel.getLastDirtyTime();
// Force a reopen of the input if this change came in later than our wait interval before we consider it
if (new Date().getTime() - lastDirtyTime > FileTracker.FILE_CHANGE_UPDATE_DELAY) {
if (Date.now() - lastDirtyTime > FileTracker.FILE_CHANGE_UPDATE_DELAY) {
let codeEditor = (<BaseTextEditor>editor).getControl();
let viewState = codeEditor.saveViewState();
let currentMtime = textModel.getLastModifiedTime(); // optimize for the case where the file did actually not change
......
......@@ -352,7 +352,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements IEncodin
// Track dirty state and version id
let wasDirty = this.dirty;
this.setDirty(true);
this.lastDirtyTime = new Date().getTime();
this.lastDirtyTime = Date.now();
// Emit as Event if we turned dirty
if (!wasDirty) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册