Created
December 4, 2016 05:22
-
-
Save shundroid/3ed6ec3a0000d62d5680681d07cc3b27 to your computer and use it in GitHub Desktop.
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
#include <emscripten.h> | |
#include "emscripten/bind.h" | |
typedef void(*JS_LISTENER)(); | |
JS_LISTENER js_listener = NULL; | |
extern "C" | |
{ | |
void set_js_listener(JS_LISTENER f) | |
{ | |
js_listener = f; | |
} | |
} | |
void call_listener() | |
{ | |
js_listener(); | |
} | |
EMSCRIPTEN_BINDINGS() | |
{ | |
emscripten::function("call_listener", &call_listener); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment