CAPI and JS?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

CAPI and JS?

Postby notepadexe » Mon Feb 19, 2018 3:17 pm

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 ?
notepadexe
Techie
 
Posts: 16
Joined: Mon Feb 19, 2018 3:13 pm

Re: CAPI and JS?

Postby Czarek » Tue Feb 20, 2018 2:40 am

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++.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CAPI and JS?

Postby notepadexe » Tue Feb 20, 2018 9:38 am

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 :>)
Last edited by notepadexe on Wed Feb 21, 2018 10:33 am, edited 1 time in total.
notepadexe
Techie
 
Posts: 16
Joined: Mon Feb 19, 2018 3:13 pm

Re: CAPI and JS?

Postby Czarek » Tue Feb 20, 2018 9:48 am

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
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CAPI and JS?

Postby notepadexe » Tue Feb 20, 2018 11:37 am

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 ! :>)
notepadexe
Techie
 
Posts: 16
Joined: Mon Feb 19, 2018 3:13 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 38 guests

cron