-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from knocknote/feature/fully-support-promise
Fully support Promise
- Loading branch information
Showing
14 changed files
with
1,427 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include "event_target.h" | ||
|
||
NAMESPACE_HTML5_BEGIN; | ||
|
||
class Blob; | ||
class File; | ||
class ArrayBuffer; | ||
|
||
class FileReader : public EventTarget { | ||
public: | ||
struct { | ||
FileReader &self; | ||
operator ArrayBuffer *() { return self.resultArrayBuffer(); }; | ||
operator std::string () { return self.resultString(); }; | ||
} result{*this}; | ||
HTML5_EVENT_HANDLER_PROPERTY(FileReader, EventHandler, onload); | ||
|
||
FileReader(emscripten::val v); | ||
virtual ~FileReader(); | ||
static FileReader *create(); | ||
void abort(); | ||
void readAsArrayBuffer(Blob *blob); | ||
void readAsArrayBuffer(File *file); | ||
void readAsBinaryString(Blob *blob); | ||
void readAsBinaryString(File *file); | ||
void readAsDataURL(Blob *blob); | ||
void readAsDataURL(File *file); | ||
void readAsText(Blob *blob, const std::string &encoding = "utf-8"); | ||
void readAsText(File *file, const std::string &encoding = "utf-8"); | ||
|
||
ArrayBuffer *resultArrayBuffer() const; | ||
std::string resultString() const; | ||
}; | ||
|
||
NAMESPACE_HTML5_END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.