Page 1 of 1

CAPI and JS?

PostPosted: Mon Feb 19, 2018 3:17 pm
by notepadexe
I am working with the CAPI but i do not understand how i am supposed to call a C function from JS with CAPI? The docs have only a singular page for CAPI and it is for reference count and a link to a github project for spawning a window. Any ideas ?

Re: CAPI and JS?

PostPosted: Tue Feb 20, 2018 2:40 am
by Czarek
See https://bitbucket.org/chromiumembedded/ ... gration.md
It's in C++, so you have to translate it to C. In C++ there is also available Generic Message Router that can make things easier, but it is not available when using C API. Apart from that other functionality related to javascript integration is available to both C and C++.

Re: CAPI and JS?

PostPosted: Tue Feb 20, 2018 9:38 am
by notepadexe
Czarek wrote:See https://bitbucket.org/chromiumembedded/ ... gration.md
It's in C++, so you have to translate it to C. In C++ there is also available Generic Message Router that can make things easier, but it is not available when using C API. Apart from that other functionality related to javascript integration is available to both C and C++.

Ty for your reply :>)

Re: CAPI and JS?

PostPosted: Tue Feb 20, 2018 9:48 am
by Czarek
You have to implement render process handler, oncontextcreated is one of its callbacks. In cefcapi example there is an example implementation of life span handler. Implement render process handler similarly.

See:
1. https://github.com/cztomczak/cefcapi/bl ... win.c#L107
2. https://github.com/cztomczak/cefcapi/bl ... _handler.h
3. https://github.com/cztomczak/cefcapi/bl ... ent.h#L111
4. https://github.com/cztomczak/cefcapi/bl ... _app.h#L69

Re: CAPI and JS?

PostPosted: Tue Feb 20, 2018 11:37 am
by notepadexe
Czarek wrote:You have to implement render process handler, oncontextcreated is one of its callbacks. In cefcapi example there is an example implementation of life span handler. Implement render process handler similarly.

See:
1. https://github.com/cztomczak/cefcapi/bl ... win.c#L107
2. https://github.com/cztomczak/cefcapi/bl ... _handler.h
3. https://github.com/cztomczak/cefcapi/bl ... ent.h#L111
4. https://github.com/cztomczak/cefcapi/bl ... _app.h#L69

I re checked the docs and what you said and then did some digging with the C API headers and saw what I was doing wrong... I implemented render process handler successfully and oncontextcreated

Ty for your reply ! :>)