I thought for the most part a lot if the “main” objects had global scope, but you may need to pass the Discourse object to the function.
For currentUser try something like
var username = Discourse.User.currentProp('username') || "anon";
I thought for the most part a lot if the “main” objects had global scope, but you may need to pass the Discourse object to the function.
For currentUser try something like
var username = Discourse.User.currentProp('username') || "anon";