How to run javascript callback function correctly?

27 views
Skip to first unread message

Felix Hintersee

unread,
Oct 24, 2021, 8:18:44 AM10/24/21
to Chromium-discuss
Hello guys,

I'm new to chromium and can't figure out how to bind and execute the callback correctly.

I tried : 

using JavaScriptResultCallback = base::OnceCallback<void(base::Value)>;

JavaScriptResultCallback callback = base::BindOnce(&RenderFrameHostImpl::TestCallback, base::Unretained(this)); 

void RenderFrameHostImpl::TestCallback(base::OnceCallback<void(base::Value)> cb) {             std::cout << "test"; 
}

and get following error message :

no viable conversion from 'OnceCallback<internal::MakeUnboundRunType<void (RenderFrameHostImpl::*)(OnceCallback<void (Value)> *) const, UnretainedWrapper<RenderFrameHostImpl>>>' to 'OnceCallback<void (base::Value)>'

What do I wrong? 



Reply all
Reply to author
Forward
0 new messages