[SOLVED] dojo.hitch(...) is not a function

Game development with Board Game Arena Studio
Post Reply
User avatar
Woodruff
Posts: 423
Joined: 08 March 2014, 00:53

[SOLVED] dojo.hitch(...) is not a function

Post by Woodruff »

Hello !

This piece of code:

Code: Select all

this.ajaxcall( "/innovation/innovation/initial_meld.html", {lock: true,
		player_id: this.my_id,
		card_id: card_id});
produces this strange error into the log:

Code: Select all

Client error: TypeError: dojo.hitch(...) is not a function. During /innovation/innovation/initial_meld.html Received: {"status":1,"data":{"valid":1,"data":null}} 
I never call this function dojo.hitch anywhere in my code, so that call must be done at some point in the BGA framework.
However, that's all, this is not a blocking error, and the game flow prosecute correctly after that :lol: ...

Should I be worried, doc'?
Last edited by Woodruff on 14 June 2017, 21:56, edited 1 time in total.
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: dojo.hitch(...) is not a function

Post by pikiou »

this.ajaxcall() requires 4 arguments and you provided 2: http://en.studio.boardgamearena.com/#!d ... amename.js
The 4th argument is a callback, the absence of which may very well be what triggers this error.
User avatar
Woodruff
Posts: 423
Joined: 08 March 2014, 00:53

[SOLVED] dojo.hitch(...) is not a function

Post by Woodruff »

Thanks Pikiou!

That effectively solved the problem.
I'll add that there are two callbacks to provide:
-first to be called after server response when success,
-second to be called after server response when success or failure.
Last edited by Woodruff on 14 June 2017, 21:57, edited 1 time in total.
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: dojo.hitch(...) is not a function

Post by pikiou »

Happy to help!
The documentation indicates that the second callback is optional so I didn't bother mentioning it, but you're right.
If this second callback is mandatory, could you fix the documentation?
User avatar
Woodruff
Posts: 423
Joined: 08 March 2014, 00:53

[SOLVED] dojo.hitch(...) is not a function

Post by Woodruff »

I try to test without it, then I see :)
Last edited by Woodruff on 14 June 2017, 21:56, edited 1 time in total.
User avatar
Woodruff
Posts: 423
Joined: 08 March 2014, 00:53

[SOLVED] dojo.hitch(...) is not a function

Post by Woodruff »

You're right, 5th argument is optional indeed. In fact, I relied on the commented pattern on the script, so I didn't notice it was optional.
So, to sum up what you said for the next one:

-Argument 1, 2 and 3 are mandatory. You pass this as the 3rd argument.
-Argument 4 is mandatory. It's a function to be called when the server call is a success. If you don't need to do anything particular, leave an empty body.
-Argument 5 is optional. It's a function to be called whatever the result or the server call is (success or failure). If you don't need that, leave an empty body or don't pass this argument at all.

Thanks a lot :D
Post Reply

Return to “Developers”