I have this bit of code which works.
I now want to use it in a typescript app. I still want to use jquery, but I don't understand how to convert the use of this to what Typescript needs to work.
if ($(this).width() < 769) {
$('body').addClass('page-small');
} else {
$('body').removeClass('page-small');
$('body').removeClass('show-sidebar');
}
In typescript, this refers to the current class. What do I replace that with so it works as expected?
thiscontext. Assuming that code shown will be inside an event handlerthiswill have context of that callback function