sort out libs / fix warnings

This commit is contained in:
Florian Dold 2016-09-14 15:55:10 +02:00
parent fc6db1824e
commit ebbdadb4b6
11 changed files with 9512 additions and 7669 deletions

BIN
articles/ui/ui.pdf Normal file

Binary file not shown.

View File

@ -3,7 +3,6 @@
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>, otiai10 <https://github.com/otiai10>, couven92 <https://github.com/couven92>, RReverser <https://github.com/rreverser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path='../webrtc/MediaStream.d.ts'/>
/// <reference path='../filesystem/filesystem.d.ts' />
////////////////////

16944
lib/decl/lib.es6.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,199 +0,0 @@
// Type definitions for WebRTC
// Project: http://dev.w3.org/2011/webrtc/
// Definitions by: Ken Smith <https://github.com/smithkl42/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Taken from http://dev.w3.org/2011/webrtc/editor/getusermedia.html
// version: W3C Editor's Draft 29 June 2015
interface ConstrainBooleanParameters {
exact?: boolean;
ideal?: boolean;
}
interface NumberRange {
max?: number;
min?: number;
}
interface ConstrainNumberRange extends NumberRange {
exact?: number;
ideal?: number;
}
interface ConstrainStringParameters {
exact?: string | string[];
ideal?: string | string[];
}
interface MediaStreamConstraints {
video?: boolean | MediaTrackConstraints;
audio?: boolean | MediaTrackConstraints;
}
declare module W3C {
type LongRange = NumberRange;
type DoubleRange = NumberRange;
type ConstrainBoolean = boolean | ConstrainBooleanParameters;
type ConstrainNumber = number | ConstrainNumberRange;
type ConstrainLong = ConstrainNumber;
type ConstrainDouble = ConstrainNumber;
type ConstrainString = string | string[] | ConstrainStringParameters;
}
interface MediaTrackConstraints extends MediaTrackConstraintSet {
advanced?: MediaTrackConstraintSet[];
}
interface MediaTrackConstraintSet {
width?: W3C.ConstrainLong;
height?: W3C.ConstrainLong;
aspectRatio?: W3C.ConstrainDouble;
frameRate?: W3C.ConstrainDouble;
facingMode?: W3C.ConstrainString;
volume?: W3C.ConstrainDouble;
sampleRate?: W3C.ConstrainLong;
sampleSize?: W3C.ConstrainLong;
echoCancellation?: W3C.ConstrainBoolean;
latency?: W3C.ConstrainDouble;
deviceId?: W3C.ConstrainString;
groupId?: W3C.ConstrainString;
}
interface MediaTrackSupportedConstraints {
width?: boolean;
height?: boolean;
aspectRatio?: boolean;
frameRate?: boolean;
facingMode?: boolean;
volume?: boolean;
sampleRate?: boolean;
sampleSize?: boolean;
echoCancellation?: boolean;
latency?: boolean;
deviceId?: boolean;
groupId?: boolean;
}
interface MediaStream extends EventTarget {
id: string;
active: boolean;
onactive: EventListener;
oninactive: EventListener;
onaddtrack: (event: MediaStreamTrackEvent) => any;
onremovetrack: (event: MediaStreamTrackEvent) => any;
clone(): MediaStream;
stop(): void;
getAudioTracks(): MediaStreamTrack[];
getVideoTracks(): MediaStreamTrack[];
getTracks(): MediaStreamTrack[];
getTrackById(trackId: string): MediaStreamTrack;
addTrack(track: MediaStreamTrack): void;
removeTrack(track: MediaStreamTrack): void;
}
interface MediaStreamTrackEvent extends Event {
track: MediaStreamTrack;
}
declare enum MediaStreamTrackState {
"live",
"ended"
}
interface MediaStreamTrack extends EventTarget {
id: string;
kind: string;
label: string;
enabled: boolean;
muted: boolean;
remote: boolean;
readyState: MediaStreamTrackState;
onmute: EventListener;
onunmute: EventListener;
onended: EventListener;
onoverconstrained: EventListener;
clone(): MediaStreamTrack;
stop(): void;
getCapabilities(): MediaTrackCapabilities;
getConstraints(): MediaTrackConstraints;
getSettings(): MediaTrackSettings;
applyConstraints(constraints: MediaTrackConstraints): Promise<void>;
}
interface MediaTrackCapabilities {
width: number | W3C.LongRange;
height: number | W3C.LongRange;
aspectRatio: number | W3C.DoubleRange;
frameRate: number | W3C.DoubleRange;
facingMode: string;
volume: number | W3C.DoubleRange;
sampleRate: number | W3C.LongRange;
sampleSize: number | W3C.LongRange;
echoCancellation: boolean[];
latency: number | W3C.DoubleRange;
deviceId: string;
groupId: string;
}
interface MediaTrackSettings {
width: number;
height: number;
aspectRatio: number;
frameRate: number;
facingMode: string;
volume: number;
sampleRate: number;
sampleSize: number;
echoCancellation: boolean;
latency: number;
deviceId: string;
groupId: string;
}
interface MediaStreamError {
name: string;
message: string;
constraintName: string;
}
interface NavigatorGetUserMedia {
(constraints: MediaStreamConstraints,
successCallback: (stream: MediaStream) => void,
errorCallback: (error: MediaStreamError) => void): void;
}
interface Navigator {
getUserMedia: NavigatorGetUserMedia;
webkitGetUserMedia: NavigatorGetUserMedia;
mozGetUserMedia: NavigatorGetUserMedia;
msGetUserMedia: NavigatorGetUserMedia;
mediaDevices: MediaDevices;
}
interface MediaDevices {
getSupportedConstraints(): MediaTrackSupportedConstraints;
getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream>;
enumerateDevices(): Promise<MediaDeviceInfo[]>;
}
interface MediaDeviceInfo {
label: string;
id: string;
kind: string;
facing: string;
}

View File

@ -93,7 +93,7 @@ export function exportDb(db: IDBDatabase): Promise<any> {
return new Promise((resolve, reject) => {
let tx = db.transaction(db.objectStoreNames);
let tx = db.transaction(Array.from(db.objectStoreNames));
tx.addEventListener("complete", () => {
resolve(dump);
});

View File

@ -164,7 +164,7 @@ enum RandomQuality {
abstract class ArenaObject {
private _nativePtr: number | undefined = undefined;
protected _nativePtr: number | undefined = undefined;
arena: Arena;
abstract destroy(): void;
@ -440,7 +440,8 @@ abstract class PackedArenaObject extends ArenaObject {
}
alloc() {
if (!this.nativePtr) {
super.alloc(this.size());
if (!this._nativePtr) {
this.nativePtr = emscAlloc.malloc(this.size());
}
}
@ -775,7 +776,7 @@ export class AbsoluteTimeNbo extends PackedArenaObject {
x.alloc();
let r = /Date\(([0-9]+)\)/;
let m = r.exec(s);
if (m.length != 2) {
if (!m || m.length != 2) {
throw Error();
}
let n = parseInt(m[1]) * 1000000;

View File

@ -373,18 +373,16 @@ export class Wallet {
exchange.baseUrl);
return;
}
let cd = {
coin: coin,
denom: exchange.active_denoms.find((e) => e.denom_pub === coin.denomPub)
};
if (!cd.denom) {
let denom = exchange.active_denoms.find((e) => e.denom_pub === coin.denomPub);
if (!denom) {
console.warn("denom not found (database inconsistent)");
return;
}
if (cd.denom.value.currency !== paymentAmount.currency) {
if (denom.value.currency !== paymentAmount.currency) {
console.warn("same pubkey for different currencies");
return;
}
let cd = {coin, denom};
let x = m[url];
if (!x) {
m[url] = [cd];

View File

@ -64,7 +64,7 @@ function makeHandlers(db: IDBDatabase,
},
["reset"]: function(detail, sender) {
if (db) {
let tx = db.transaction(db.objectStoreNames, 'readwrite');
let tx = db.transaction(Array.from(db.objectStoreNames), 'readwrite');
for (let i = 0; i < db.objectStoreNames.length; i++) {
tx.objectStore(db.objectStoreNames[i]).clear();
}
@ -313,7 +313,7 @@ export function wxMain() {
console.error("could not open database");
console.error(e);
})
.then((db) => {
.then((db: IDBDatabase) => {
let http = new BrowserHttpLib();
let badge = new ChromeBadge();
let notifier = new ChromeNotifier();

View File

@ -95,7 +95,7 @@ export function main() {
}
};
m.mount(document.getElementById("contract"), Contract);
m.mount(document.getElementById("contract")!, Contract);
function checkPayment() {
chrome.runtime.sendMessage({type: 'check-pay', detail: {offer}}, (resp) => {

View File

@ -189,7 +189,7 @@ class Controller {
}
function view(ctrl: Controller): any {
function* f() {
function* f(): IterableIterator<any> {
yield m("p",
i18n.parts`You are about to withdraw ${m("strong", amountToPretty(
ctrl.amount))} from your bank account into your wallet.`);
@ -374,8 +374,8 @@ export function main() {
getSuggestedExchange(amount.currency)
.then((suggestedExchangeUrl) => {
const controller = function () { return new Controller(suggestedExchangeUrl, amount, callback_url, wt_types); };
var ExchangeSelection = {controller, view};
m.mount(document.getElementById("exchange-selection"), ExchangeSelection);
const ExchangeSelection = {controller, view};
m.mount(document.getElementById("exchange-selection")!, ExchangeSelection);
})
.catch((e) => {
// TODO: provide more context information, maybe factor it out into a

View File

@ -48,6 +48,10 @@ function prettyPrint(obj: any) {
document.addEventListener("DOMContentLoaded", () => {
chrome.runtime.sendMessage({type: 'dump-db'}, (resp) => {
document.getElementById('dump').innerHTML = prettyPrint(resp);
const el = document.getElementById('dump');
if (!el) {
throw Error();
}
el.innerHTML = prettyPrint(resp);
});
});