|
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 * http://dev.w3.org/2006/webapi/FileAPI/#dfn-filereader |
|
8 * |
|
9 * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C |
|
10 * liability, trademark and document use rules apply. |
|
11 */ |
|
12 |
|
13 [Constructor] |
|
14 interface FileReader : EventTarget { |
|
15 // async read methods |
|
16 [Throws] |
|
17 void readAsArrayBuffer(Blob blob); |
|
18 [Throws] |
|
19 void readAsText(Blob blob, optional DOMString label = ""); |
|
20 [Throws] |
|
21 void readAsDataURL(Blob blob); |
|
22 |
|
23 [Throws] |
|
24 void abort(); |
|
25 |
|
26 // states |
|
27 const unsigned short EMPTY = 0; |
|
28 const unsigned short LOADING = 1; |
|
29 const unsigned short DONE = 2; |
|
30 |
|
31 |
|
32 readonly attribute unsigned short readyState; |
|
33 |
|
34 // File or Blob data |
|
35 // bug 858217: readonly attribute (DOMString or ArrayBuffer)? result; |
|
36 [Throws] |
|
37 readonly attribute any result; |
|
38 |
|
39 readonly attribute DOMError? 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 |
|
50 // Mozilla extensions. |
|
51 partial interface FileReader { |
|
52 [Throws] |
|
53 void readAsBinaryString(Blob filedata); |
|
54 }; |