Custom component callEvent

Hi, I am creating a custom component for the Google Recaptcha.

When the user completes the captcha, a callback is called.

I am capturing this callback in my component and want to raise an event so any code that is using the component can react to it.

I am using the webix.callEvent() method in the code below and when I step through it, I can see it firing. But, the code that is attached and waiting on the event never gets fired.

Any ideas why this might be?

Attach Event…

 var recaptcha = this.$$("recaptcha");

    recaptcha.attachEvent("verified", function(){

Custom Component…

name: “recaptcha”,
defaults : {

    var elm = webix.html.create("div", {
		 style : "margin:10px!important"
	this._waitWidget = webix.promise.defer();
	var cdn = "";

	]).then(webix.bind(this._init_recaptcha, this)).catch(function(e){
	var config = this.config.config;
	config.callback = this._callback;
	window.grecaptcha.ready(() => {					
		this._widget = window.grecaptcha.render(this.$view.firstChild, config);

	webix.callEvent("verified", 1);

}, webix.ui.view, webix.EventSystem);

you are listening to event on recaptcha view, but raise a global event verified.
try to use this.callEvent("verified", 1);

That makes sense @intregal but I’m getting a

“Uncaught (in promise) TypeError anchor:1”

I can’t step into it or see the code in the console.

probably you need to change config.callback = this._callback; to config.callback = this._callback.bind(this);

Tried it but the attachEvent never fires.

I can use it with the Global Event for now.


did you try both this.callEvent("verified", 1); and config.callback = this._callback.bind(this); together?