1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://w3c.github.io/FileAPI/#APIASynch 8 * 9 * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C 10 * liability, trademark and document use rules apply. 11 */ 12 13[Exposed=(Window,Worker)] 14interface FileReader : EventTarget { 15 constructor(); 16 17 // async read methods 18 [Throws] 19 void readAsArrayBuffer(Blob blob); 20 [Throws] 21 void readAsBinaryString(Blob filedata); 22 [Throws] 23 void readAsText(Blob blob, optional DOMString label); 24 [Throws] 25 void readAsDataURL(Blob blob); 26 27 void abort(); 28 29 // states 30 const unsigned short EMPTY = 0; 31 const unsigned short LOADING = 1; 32 const unsigned short DONE = 2; 33 34 35 readonly attribute unsigned short readyState; 36 37 readonly attribute (DOMString or ArrayBuffer)? result; 38 39 readonly attribute DOMException? error; 40 41 // event handler attributes 42 attribute EventHandler onloadstart; 43 attribute EventHandler onprogress; 44 attribute EventHandler onload; 45 attribute EventHandler onabort; 46 attribute EventHandler onerror; 47 attribute EventHandler onloadend; 48}; 49