/js-bind

js::bind makes any C++ function, member function or lambda as a Javascript callback.

Primary LanguageC++Boost Software License 1.0BSL-1.0

js::bind

js::bind makes any C++ function, member function or lambda as a Javascript callable callback for Emscripten.

Easy to use

It's header only. You can set-it-up in 0-time with : nxxm ., add this to .nxxm/deps

{
  "nxxm/js-bind" : { "@" : "v0.0.3" } 
}
  using namespace std;
  using namespace std::placeholders;
  using emscripten::val;

  auto clickme_btn = val::global("document").call<val>("getElementById", "clickme_btn"s);

  auto onclick = [](val event){ 
    std::cout << "hello world ! " << std::endl; 
  };

  clickme_btn.set("onclick", js::bind(onclick, _1));

License

Please give copyright notice for this project : Boost Software License.

Copyright (c) 2017 Damien Buhl alias daminetreg (damien.buhl@lecbna.org)