@@ -174,9 +174,9 @@ define([
174174 ( function ( snippetCode ) {
175175 /**
176176 * user's are get used to or might expect to have jQuery available globally
177- * and they will write their code according to that, and since we, in this widget, don't expose
178- * jQuery globally, we'll check user's code snippet if there is any attempt to access jQuery
179- * from the global scope ( window ).
177+ * and they will write their code according to that, and since we, in this widget, don't expose
178+ * jQuery globally, we'll check user's code snippet if there is any attempt to access jQuery
179+ * from the global scope ( window ).
180180 */
181181 var jqueryIdRegex1 = / w i n d o w .\j Q u e r y / g;
182182 var jqueryIdRegex2 = / w i n d o w .\$ / g;
@@ -188,7 +188,8 @@ define([
188188 "console.debug('your code snippet is evaluated and executed against JQuery version:'+ this.jquery.fn.jquery);" ;
189189 eval ( snippetCode ) ;
190190 } ) . call ( {
191- jquery : jQuery // pass JQuery as the context of the immediate function which will wrap the code snippet
191+ jquery : jQuery , // pass JQuery as the context of the immediate function which will wrap the code snippet
192+ widget : this // pass the HTMLSnippet widget context itself, so the code could use listen/addOnDestroy
192193 } , this . contents ) ; // pass the code snippet as an arg
193194 } catch ( error ) {
194195 this . _handleError ( error ) ;
0 commit comments