do a window.myObject.myFunction in JS

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

Re: do a window.myObject.myFunction in JS

Postby robind336 » Mon Dec 08, 2014 4:04 am

Hi Czarek,

I think I realised when the problem is coming.Only window.myobject.myfunc() is working fine since in the code currently I am registering to the window object "myObject" and to it I am adding "myFunc". BUT in the JS first I check if window.myObject is true, if so, I am calling window.myObject.myFunc. . This is somehow failing and giving me the error "Uncaught TypeError: undefined is not a function", source: https://xxx.com/app/homepage"
This is how the JS looks like.
Please see and tell me if you can get an idea why its failing. I have put alerts for testing purpose

Code: Select all
<script>
function willHandleView() {
  var canhandleview;
  if(window.myObject) {
     canhandleview = window.myObject.myFunc();
     alert(canhandleview );
   }
</script>


Please note that alert of window.myObject shows me "[object Object]".

Please help.
robind336
Techie
 
Posts: 17
Joined: Mon Sep 01, 2014 9:38 am

Re: do a window.myObject.myFunction in JS

Postby robind336 » Tue Dec 09, 2014 10:41 pm

Hi Czarek,

This is how MyV8Handler.cs file looks like. I have just overidden the "Execute" method in it and returning true;

protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
{
exception = null;
returnValue = CefV8Value.CreateString("");
return true;
}

Can you please help me with whats wrong here.
robind336
Techie
 
Posts: 17
Joined: Mon Sep 01, 2014 9:38 am

Previous

Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 18 guests