With minimal changes to your code here:
var obj = (function ($) { return { func1: function() { console.log("do something"); }, func2: function () { $("#debug").click(function () { this.func1(); //2. ΠΎΠ±ΡΠ°ΡΠ°Π΅ΠΌΡΡ ΠΊ Π½ΡΠΆΠ½ΠΎΠΌΡ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΡ }.bind(this)) //1. ΠΏΡΠΈΠ²ΡΠ·ΡΠ²Π°Π΅ΠΌ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡ } } })(jQuery); obj.func2();
Meaning next
one). The handler is passed the context of the object. You can do this not via bind if you do not want to replace the entire context of the handler, for example, by saving it in a local variable in the spirit of var me = this
2). Actually, we have a context, it has a function, it remains to invoke it.
Yes, I would add that it would be better to define the functions that you return to return, it will be much clearer. But this is a stylistic question.