Pārlūkot izejas kodu

Updates to TypeScript 3.2.1

main
Eric Amodio pirms 6 gadiem
vecāks
revīzija
6bab295572
7 mainītis faili ar 40 papildinājumiem un 56 dzēšanām
  1. +7
    -7
      package-lock.json
  2. +2
    -2
      package.json
  3. +6
    -6
      src/system/function.ts
  4. +6
    -7
      src/ui/settings/app.ts
  5. +15
    -27
      src/ui/shared/app-base.ts
  6. +2
    -2
      src/ui/shared/dom.ts
  7. +2
    -5
      ui.tsconfig.json

+ 7
- 7
package-lock.json Parādīt failu

@ -8153,9 +8153,9 @@
"dev": true
},
"prettier": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.2.tgz",
"integrity": "sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug==",
"version": "1.15.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz",
"integrity": "sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==",
"dev": true
},
"prettier-tslint": {
@ -8468,7 +8468,7 @@
},
"queue": {
"version": "3.1.0",
"resolved": "http://registry.npmjs.org/queue/-/queue-3.1.0.tgz",
"resolved": "https://registry.npmjs.org/queue/-/queue-3.1.0.tgz",
"integrity": "sha1-bEnQHwCeIlZ4h4nyv/rGuLmZBYU=",
"dev": true,
"requires": {
@ -10767,9 +10767,9 @@
"dev": true
},
"typescript": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz",
"integrity": "sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.1.tgz",
"integrity": "sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg==",
"dev": true
},
"uc.micro": {

+ 2
- 2
package.json Parādīt failu

@ -4428,7 +4428,7 @@
"imagemin-webpack-plugin": "2.3.0",
"mini-css-extract-plugin": "0.4.4",
"node-sass": "4.10.0",
"prettier": "1.15.2",
"prettier": "1.15.3",
"prettier-tslint": "0.4.0",
"sass-loader": "7.1.0",
"terser-webpack-plugin": "1.1.0",
@ -4436,7 +4436,7 @@
"tslint-loader": "3.5.4",
"tslint-prettiest": "0.0.1",
"ts-loader": "5.3.1",
"typescript": "3.1.6",
"typescript": "3.2.1",
"vsce": "1.53.2",
"vscode": "1.1.22",
"webpack": "4.26.1",

+ 6
- 6
src/system/function.ts Parādīt failu

@ -50,27 +50,27 @@ export namespace Functions {
let pending = false;
const debounced = _debounce(
(function(this: any) {
(function(this: any, ...args: any[]) {
pending = false;
return fn.apply(this, arguments);
return fn.apply(this, args);
} as any) as T,
wait,
options
) as T & IDeferrable;
const tracked = (function(this: any) {
const tracked = (function(this: any, ...args: any[]) {
pending = true;
return debounced.apply(this, arguments);
return debounced.apply(this, args);
} as any) as T & IDeferrable;
tracked.pending = function() {
return pending;
};
tracked.cancel = function() {
return debounced.cancel.apply(debounced, arguments);
return debounced.cancel.apply(debounced);
};
tracked.flush = function(...args: any[]) {
return debounced.flush.apply(debounced, arguments);
return debounced.flush.apply(debounced, args);
};
return tracked;

+ 6
- 7
src/ui/settings/app.ts Parādīt failu

@ -32,14 +32,13 @@ export class SettingsApp extends App {
}
protected onBind() {
const onSectionHeaderClicked = this.onSectionHeaderClicked.bind(this);
DOM.listenAll('.section__header', 'click', function(this: HTMLInputElement) {
return onSectionHeaderClicked(this, ...arguments);
});
const me = this;
const onActionLinkClicked = this.onActionLinkClicked.bind(this);
DOM.listenAll('[data-action]', 'click', function(this: HTMLAnchorElement) {
return onActionLinkClicked(this, ...arguments);
DOM.listenAll('.section__header', 'click', function(this: HTMLInputElement, e: Event) {
return me.onSectionHeaderClicked(this, e as MouseEvent);
});
DOM.listenAll('[data-action]', 'click', function(this: HTMLAnchorElement, e: Event) {
return me.onActionLinkClicked(this, e as MouseEvent);
});
}

+ 15
- 27
src/ui/shared/app-base.ts Parādīt failu

@ -173,7 +173,7 @@ export abstract class App {
el.scrollIntoView({
block: 'start',
behavior: 'instant'
behavior: 'auto'
});
window.scrollBy(0, -height);
@ -223,42 +223,30 @@ export abstract class App {
private bind() {
this.onBind();
const onMessageReceived = this.onMessageReceived.bind(this);
window.addEventListener('message', onMessageReceived);
window.addEventListener('message', this.onMessageReceived.bind(this));
const me = this;
const onInputChecked = this.onInputChecked.bind(this);
DOM.listenAll('input[type=checkbox].setting', 'change', function(this: HTMLInputElement) {
return onInputChecked(this, ...arguments);
return me.onInputChecked(this);
});
const onInputBlurred = this.onInputBlurred.bind(this);
DOM.listenAll('input[type=text].setting, input:not([type]).setting', 'blur', function(this: HTMLInputElement) {
return onInputBlurred(this, ...arguments);
return me.onInputBlurred(this);
});
const onInputFocused = this.onInputFocused.bind(this);
DOM.listenAll('input[type=text].setting, input:not([type]).setting', 'focus', function(this: HTMLInputElement) {
return onInputFocused(this, ...arguments);
return me.onInputFocused(this);
});
const onInputSelected = this.onInputSelected.bind(this);
DOM.listenAll('select.setting', 'change', function(this: HTMLInputElement) {
return onInputSelected(this, ...arguments);
DOM.listenAll('select.setting', 'change', function(this: HTMLSelectElement) {
return me.onInputSelected(this);
});
const onTokenMouseDown = this.onTokenMouseDown.bind(this);
DOM.listenAll('[data-token]', 'mousedown', function(this: HTMLElement) {
return onTokenMouseDown(this, ...arguments);
DOM.listenAll('[data-token]', 'mousedown', function(this: HTMLElement, e: Event) {
return me.onTokenMouseDown(this, e as MouseEvent);
});
const onPopupMouseDown = this.onPopupMouseDown.bind(this);
DOM.listenAll('.popup', 'mousedown', function(this: HTMLElement) {
return onPopupMouseDown(this, ...arguments);
DOM.listenAll('.popup', 'mousedown', function(this: HTMLElement, e: Event) {
return me.onPopupMouseDown(this, e as MouseEvent);
});
const onJumpToLinkClicked = this.onJumpToLinkClicked.bind(this);
DOM.listenAll('a.jump-to[href^="#"]', 'click', function(this: HTMLAnchorElement) {
return onJumpToLinkClicked(this, ...arguments);
DOM.listenAll('a.jump-to[href^="#"]', 'click', function(this: HTMLAnchorElement, e: Event) {
return me.onJumpToLinkClicked(this, e as MouseEvent);
});
}

+ 2
- 2
src/ui/shared/dom.ts Parādīt failu

@ -35,8 +35,8 @@ export namespace DOM {
// return element.querySelectorAll(selectors) as NodeList<T>;
// }
export function listenAll(selector: string, name: string, listener: EventListenerOrEventListenerObject) {
const els = document.querySelectorAll(selector);
export function listenAll(selector: string, name: string, listener: EventListener) {
const els = (document.querySelectorAll(selector) as unknown) as Element[];
for (const el of els) {
el.addEventListener(name, listener, false);
}

+ 2
- 5
ui.tsconfig.json Parādīt failu

@ -1,16 +1,13 @@
{
"version": "2.0.0",
"compileOnSave": false,
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"lib": ["es5", "dom", "dom.iterable", "es2015", "es2015.iterable", "es2016"],
"lib": ["dom", "dom.iterable", "es2015", "es2015.iterable", "es2016"],
"module": "es2015",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedLocals": false,
"outDir": "dist/ui",
"removeComments": true,
"rootDir": "./src/ui",
"skipLibCheck": true,
"sourceMap": true,

Notiek ielāde…
Atcelt
Saglabāt