Open jcubic opened 2 weeks ago
The task is to add this context (that in source code is in self variable) to mousewheel and touchscroll and update TypeScript types for the callbacks.
self
mousewheel
touchscroll
This code should work:
function scroll() { const { length } = this.get_output().split('\n'); const rows = term.rows(); if (rows > length) { this.removeClass('shake'); this.addClass('shake'); this.stopTime('shake'); this.oneTime(200, 'shake', () => { this.removeClass('shake'); }); } } export function initTerminal() { const $ = globalThis.$; const $term = $('.term'); $term.empty(); const term = $term.terminal({}, { mousewheel: scroll, touchscroll: scroll }); return $term; };
Code taken from new website (after refactoring to new API).
I have an idea for a new feature for jQuery Terminal
The task is to add this context (that in source code is in
self
variable) tomousewheel
andtouchscroll
and update TypeScript types for the callbacks.This code should work:
Code taken from new website (after refactoring to new API).