Skip to content
Permalink
Browse files

fix: re-expose DomFile (denoland#2100)

  • Loading branch information...
kt3k authored and ry committed Apr 12, 2019
1 parent ea1b051 commit e0edcc9c1b025c2b02eb5b50ae7a86089d1c4d61
Showing with 9 additions and 11 deletions.
  1. +5 −3 js/dom_types.ts
  2. +3 −5 js/globals.ts
  3. +1 −3 js/unit_tests.ts
@@ -196,14 +196,16 @@ export interface CustomEvent extends Event {
): void;
}

/* TODO(ry) Re-expose this interface. There is currently some interference
* between deno's File and this one.
*/
export interface DomFile extends Blob {
readonly lastModified: number;
readonly name: string;
}

export interface DomFileConstructor {
new (bits: BlobPart[], filename: string, options?: FilePropertyBag): DomFile;
prototype: DomFile;
}

export interface FilePropertyBag extends BlobPropertyBag {
lastModified?: number;
}
@@ -13,6 +13,7 @@ import * as consoleTypes from "./console";
import * as customEvent from "./custom_event";
import * as deno from "./deno";
import * as domTypes from "./dom_types";
import * as domFile from "./dom_file";
import * as event from "./event";
import * as eventTarget from "./event_target";
import * as formData from "./form_data";
@@ -74,11 +75,8 @@ window.location = (undefined as unknown) as domTypes.Location;
window.Blob = blob.DenoBlob;
export type Blob = blob.DenoBlob;

// TODO(ry) Do not export a class implementing the DOM, export the DOM
// interface. See this comment for implementation hint:
// https://github.com/denoland/deno/pull/1396#discussion_r243711502
// window.File = file.DenoFile;
// export type File = file.DenoFile;
window.File = domFile.DenoFile as domTypes.DomFileConstructor;
export type File = domTypes.DomFile;

window.CustomEventInit = customEvent.CustomEventInit;
export type CustomEventInit = customEvent.CustomEventInit;
@@ -16,9 +16,7 @@ import "./dir_test.ts";
import "./event_test.ts";
import "./event_target_test.ts";
import "./fetch_test.ts";
// TODO The global "File" has been temporarily disabled. See the note in
// js/globals.ts
// import "./file_test.ts";
import "./file_test.ts";
import "./files_test.ts";
import "./form_data_test.ts";
import "./globals_test.ts";

0 comments on commit e0edcc9

Please sign in to comment.
You can’t perform that action at this time.