Skip to content
/ js-bind Public
forked from daminetreg/js-bind

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

License

Notifications You must be signed in to change notification settings

nxxm/js-bind

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 56.1%
  • HTML 38.1%
  • CMake 5.8%