Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports Closure Compiler #24

Merged
merged 3 commits into from
Feb 14, 2019
Merged

Supports Closure Compiler #24

merged 3 commits into from
Feb 14, 2019

Conversation

goccy
Copy link
Contributor

@goccy goccy commented Feb 14, 2019

Fix syntax in EM_ASM to support closure compiler.
Also, add Uint8Array class and remove XMLHttpResponse type.

So, you can write like the following.

    auto request = XMLHttpRequest::create();
    request->open("GET", "resource.bin", true);
    static EventHandler onload = [request](Event *e) {
        ArrayBuffer *arraybuf = request->response;
        auto array = Uint8Array::create(arraybuf);
        size_t len = array->length;
        uint8_t rawbuf[len];
        for (size_t i = 0; i < len; ++i) {
            uint8_t ch = (*array)[i];
            rawbuf[i] = ch;
        }
    };
    request->onload = &onload;
    request->responseType = XMLHttpResponseType::ARRAY_BUFFER;
    request->send();

@kanataxa
Copy link
Contributor

LGTM 👍

@goccy
Copy link
Contributor Author

goccy commented Feb 14, 2019

Thanks !!!

@goccy goccy merged commit 4e71825 into master Feb 14, 2019
@goccy goccy deleted the feature/support-closure-compiler branch February 14, 2019 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants