ReferenceError: Must call super constructor in derived class before accessing 'this'

pull/1441/head
Simon Legner 1 year ago
parent a725a0aabb
commit 81c0551d35

@ -19,10 +19,6 @@
}
constructor() {
this.onOpenSuccess = this.onOpenSuccess.bind(this);
this.onOpenError = this.onOpenError.bind(this);
this.checkForCorruptedDocs = this.checkForCorruptedDocs.bind(this);
this.deleteCorruptedDocs = this.deleteCorruptedDocs.bind(this);
this.versionMultipler = $.isIE() ? 1e5 : 1e9;
this.useIndexedDB = this.useIndexedDB();
this.callbacks = [];
@ -45,9 +41,9 @@
NAME,
VERSION * this.versionMultipler + this.userVersion(),
);
req.onsuccess = this.onOpenSuccess;
req.onerror = this.onOpenError;
req.onupgradeneeded = this.onUpgradeNeeded;
req.onsuccess = (event) => this.onOpenSuccess(event);
req.onerror = (event) => this.onOpenError(event);
req.onupgradeneeded = (event) => this.onUpgradeNeeded(event);
} catch (error) {
this.fail("exception", error);
}
@ -378,8 +374,7 @@
load(entry, onSuccess, onError) {
if (this.shouldLoadWithIDB(entry)) {
onError = this.loadWithXHR.bind(this, entry, onSuccess, onError);
return this.loadWithIDB(entry, onSuccess, onError);
return this.loadWithIDB(entry, onSuccess, () => this.loadWithXHR(entry, onSuccess, onError));
} else {
return this.loadWithXHR(entry, onSuccess, onError);
}
@ -440,7 +435,7 @@
mode: "readonly",
});
txn.oncomplete = () => {
setTimeout(this.checkForCorruptedDocs, 50);
setTimeout(() => this.checkForCorruptedDocs(), 50);
};
const req = txn.objectStore("docs").openCursor();
@ -486,7 +481,7 @@
}
if (docs.length === 0) {
setTimeout(this.deleteCorruptedDocs, 0);
setTimeout(() => this.deleteCorruptedDocs(), 0);
return;
}
@ -497,7 +492,7 @@
});
txn.oncomplete = () => {
if (this.corruptedDocs.length > 0) {
setTimeout(this.deleteCorruptedDocs, 0);
setTimeout(() => this.deleteCorruptedDocs(), 0);
}
};

@ -215,12 +215,7 @@ function scoreFuzzyMatch() {
}
constructor(options) {
this.match = this.match.bind(this);
this.matchChunks = this.matchChunks.bind(this);
if (options == null) {
options = {};
}
this.options = $.extend({}, DEFAULTS, options);
this.options = $.extend({}, DEFAULTS, options || {});
}
find(data, attr, q) {
@ -307,10 +302,10 @@ function scoreFuzzyMatch() {
this.matchChunk();
if (this.cursor === this.dataLength || this.scoredEnough()) {
this.delay(this.match);
this.delay(() => this.match());
this.sendResults();
} else {
this.delay(this.matchChunks);
this.delay(() => this.matchChunks());
}
}
@ -410,11 +405,6 @@ function scoreFuzzyMatch() {
})();
app.SynchronousSearcher = class SynchronousSearcher extends app.Searcher {
constructor(...args) {
this.match = this.match.bind(this);
super(...args);
}
match() {
if (this.matcher) {
if (!this.allResults) {

@ -16,7 +16,6 @@ app.ServiceWorker = class ServiceWorker {
}
constructor() {
this.onUpdateFound = this.onUpdateFound.bind(this);
this.onStateChange = this.onStateChange.bind(this);
this.registration = null;
this.notifyUpdate = true;
@ -51,12 +50,12 @@ app.ServiceWorker = class ServiceWorker {
updateRegistration(registration) {
this.registration = registration;
$.on(this.registration, "updatefound", this.onUpdateFound);
$.on(this.registration, "updatefound", () => this.onUpdateFound());
}
onUpdateFound() {
if (this.installingRegistration) {
$.off(this.installingRegistration, "statechange", this.onStateChange());
$.off(this.installingRegistration, "statechange", this.onStateChange);
}
this.installingRegistration = this.registration.installing;
$.on(this.installingRegistration, "statechange", this.onStateChange);

@ -7,16 +7,14 @@
*/
app.UpdateChecker = class UpdateChecker {
constructor() {
this.checkDocs = this.checkDocs.bind(this);
this.onFocus = this.onFocus.bind(this);
this.lastCheck = Date.now();
$.on(window, "focus", this.onFocus);
$.on(window, "focus", () => this.onFocus());
if (app.serviceWorker != null) {
app.serviceWorker.on("updateready", this.onUpdateReady);
app.serviceWorker.on("updateready", () => this.onUpdateReady());
}
setTimeout(this.checkDocs, 0);
setTimeout(() => this.checkDocs(), 0);
}
check() {

@ -110,7 +110,7 @@ this.viewTree = function (view, level, visited) {
`%c ${Array(level + 1).join(" ")}${
view.constructor.name
}: ${!!view.activated}`,
"color:" + ((view.activated && "green") || "red")
"color:" + ((view.activated && "green") || "red"),
);
for (var key of Object.keys(view || {})) {

@ -48,14 +48,12 @@ class Events {
}
trigger(event, ...args) {
let callbacks;
this.eventInProgress = { name: event, args };
if (
(callbacks = this._callbacks != null ? this._callbacks[event] : undefined)
) {
for (var callback of Array.from(callbacks.slice(0))) {
const callbacks = this._callbacks?.[event];
if (callbacks) {
for (let callback of Array.from(callbacks.slice(0))) {
if (typeof callback === "function") {
callback(...Array.from(args || []));
callback(...args);
}
}
}

@ -13,24 +13,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.Content = class Content extends app.View {
constructor(...args) {
this.scrollToTop = this.scrollToTop.bind(this);
this.scrollToBottom = this.scrollToBottom.bind(this);
this.scrollStepUp = this.scrollStepUp.bind(this);
this.scrollStepDown = this.scrollStepDown.bind(this);
this.scrollPageUp = this.scrollPageUp.bind(this);
this.scrollPageDown = this.scrollPageDown.bind(this);
this.onReady = this.onReady.bind(this);
this.onBootError = this.onBootError.bind(this);
this.onEntryLoading = this.onEntryLoading.bind(this);
this.onEntryLoaded = this.onEntryLoaded.bind(this);
this.beforeRoute = this.beforeRoute.bind(this);
this.afterRoute = this.afterRoute.bind(this);
this.onClick = this.onClick.bind(this);
this.onAltF = this.onAltF.bind(this);
super(...args);
}
static initClass() {
this.el = "._content";
this.loadingClass = "_content-loading";
@ -68,10 +50,12 @@ app.views.Content = class Content extends app.View {
this.entryPage = new app.views.EntryPage();
this.entryPage
.on("loading", this.onEntryLoading)
.on("loaded", this.onEntryLoaded);
.on("loading", () => this.onEntryLoading())
.on("loaded", () => this.onEntryLoaded());
app.on("ready", this.onReady).on("bootError", this.onBootError);
app
.on("ready", () => this.onReady())
.on("bootError", () => this.onBootError());
}
show(view) {

@ -13,16 +13,6 @@
(function () {
let LINKS = undefined;
app.views.EntryPage = class EntryPage extends app.View {
constructor(...args) {
this.beforeRoute = this.beforeRoute.bind(this);
this.onSuccess = this.onSuccess.bind(this);
this.onError = this.onError.bind(this);
this.onClick = this.onClick.bind(this);
this.onAltC = this.onAltC.bind(this);
this.onAltO = this.onAltO.bind(this);
super(...args);
}
static initClass() {
this.className = "_page";
this.errorClass = "_page-error";
@ -182,7 +172,10 @@
load() {
this.loading();
this.xhr = this.entry.loadFile(this.onSuccess, this.onError);
this.xhr = this.entry.loadFile(
(response) => this.onSuccess(response),
() => this.onError(),
);
}
abort() {

@ -9,11 +9,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.OfflinePage = class OfflinePage extends app.View {
constructor(...args) {
this.onClick = this.onClick.bind(this);
super(...args);
}
static initClass() {
this.className = "_static";

@ -8,11 +8,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.RootPage = class RootPage extends app.View {
constructor(...args) {
this.onClick = this.onClick.bind(this);
super(...args);
}
static initClass() {
this.events = { click: "onClick" };
}

@ -10,12 +10,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.SettingsPage = class SettingsPage extends app.View {
constructor(...args) {
this.onChange = this.onChange.bind(this);
this.onClick = this.onClick.bind(this);
super(...args);
}
static initClass() {
this.className = "_static";

@ -9,12 +9,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.Document = class Document extends app.View {
constructor(...args) {
this.afterRoute = this.afterRoute.bind(this);
this.onVisibilityChange = this.onVisibilityChange.bind(this);
super(...args);
}
static initClass() {
this.el = document;

@ -7,11 +7,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.Menu = class Menu extends app.View {
constructor(...args) {
this.onGlobalClick = this.onGlobalClick.bind(this);
super(...args);
}
static initClass() {
this.el = "._menu";
this.activeClass = "active";
@ -20,7 +15,7 @@ app.views.Menu = class Menu extends app.View {
}
init() {
$.on(document.body, "click", this.onGlobalClick);
$.on(document.body, "click", (event) => this.onGlobalClick(event));
}
onClick(event) {

@ -54,44 +54,36 @@ app.views.Mobile = class Mobile extends app.View {
}
constructor() {
this.showSidebar = this.showSidebar.bind(this);
this.hideSidebar = this.hideSidebar.bind(this);
this.onClickBack = this.onClickBack.bind(this);
this.onClickForward = this.onClickForward.bind(this);
this.onClickToggleSidebar = this.onClickToggleSidebar.bind(this);
this.onClickDocPickerTab = this.onClickDocPickerTab.bind(this);
this.onClickSettingsTab = this.onClickSettingsTab.bind(this);
this.onTapSearch = this.onTapSearch.bind(this);
this.onEscape = this.onEscape.bind(this);
this.afterRoute = this.afterRoute.bind(this);
this.el = document.documentElement;
super(...arguments);
this.el = document.documentElement;
}
init() {
$.on($("._search"), "touchend", this.onTapSearch);
$.on($("._search"), "touchend", () => this.onTapSearch());
this.toggleSidebar = $("button[data-toggle-sidebar]");
this.toggleSidebar.removeAttribute("hidden");
$.on(this.toggleSidebar, "click", this.onClickToggleSidebar);
$.on(this.toggleSidebar, "click", () => this.onClickToggleSidebar());
this.back = $("button[data-back]");
this.back.removeAttribute("hidden");
$.on(this.back, "click", this.onClickBack);
$.on(this.back, "click", () => this.onClickBack());
this.forward = $("button[data-forward]");
this.forward.removeAttribute("hidden");
$.on(this.forward, "click", this.onClickForward);
$.on(this.forward, "click", () => this.onClickForward());
this.docPickerTab = $('button[data-tab="doc-picker"]');
this.docPickerTab.removeAttribute("hidden");
$.on(this.docPickerTab, "click", this.onClickDocPickerTab);
$.on(this.docPickerTab, "click", (event) =>
this.onClickDocPickerTab(event),
);
this.settingsTab = $('button[data-tab="settings"]');
this.settingsTab.removeAttribute("hidden");
$.on(this.settingsTab, "click", this.onClickSettingsTab);
$.on(this.settingsTab, "click", (event) => this.onClickSettingsTab(event));
app.document.sidebar.search.on("searching", this.showSidebar);
app.document.sidebar.search.on("searching", () => this.showSidebar());
this.activate();
}

@ -8,12 +8,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.Path = class Path extends app.View {
constructor(...args) {
this.onClick = this.onClick.bind(this);
this.afterRoute = this.afterRoute.bind(this);
super(...args);
}
static initClass() {
this.className = "_path";
this.attributes = { role: "complementary" };

@ -11,13 +11,6 @@
let MIN = undefined;
let MAX = undefined;
app.views.Resizer = class Resizer extends app.View {
constructor(...args) {
this.onDragStart = this.onDragStart.bind(this);
this.onDrag = this.onDrag.bind(this);
this.onDragEnd = this.onDragEnd.bind(this);
super(...args);
}
static initClass() {
this.className = "_resizer";

@ -13,15 +13,6 @@
(function () {
let SIDEBAR_HIDDEN_LAYOUT = undefined;
app.views.Settings = class Settings extends app.View {
constructor(...args) {
this.onChange = this.onChange.bind(this);
this.onEnter = this.onEnter.bind(this);
this.onSubmit = this.onSubmit.bind(this);
this.onImport = this.onImport.bind(this);
this.onClick = this.onClick.bind(this);
super(...args);
}
static initClass() {
SIDEBAR_HIDDEN_LAYOUT = "_sidebar-hidden";

@ -25,15 +25,8 @@ app.views.ListFocus = class ListFocus extends app.View {
}
constructor(el) {
this.blur = this.blur.bind(this);
this.onDown = this.onDown.bind(this);
this.onUp = this.onUp.bind(this);
this.onLeft = this.onLeft.bind(this);
this.onEnter = this.onEnter.bind(this);
this.onSuperEnter = this.onSuperEnter.bind(this);
this.onClick = this.onClick.bind(this);
this.el = el;
super(...arguments);
this.el = el;
this.focusOnNextFrame = $.framify(this.focus, this);
}

@ -23,11 +23,8 @@ app.views.ListFold = class ListFold extends app.View {
}
constructor(el) {
this.onLeft = this.onLeft.bind(this);
this.onRight = this.onRight.bind(this);
this.onClick = this.onClick.bind(this);
this.el = el;
super(...arguments);
this.el = el;
}
open(el) {

@ -16,9 +16,8 @@ app.views.ListSelect = class ListSelect extends app.View {
}
constructor(el) {
this.onClick = this.onClick.bind(this);
this.el = el;
super(...arguments);
this.el = el;
}
deactivate() {

@ -13,20 +13,15 @@ app.views.Notif = class Notif extends app.View {
this.activeClass = "_in";
this.attributes = { role: "alert" };
this.defautOptions = { autoHide: 15000 };
this.defaultOptions = { autoHide: 15000 };
this.events = { click: "onClick" };
}
constructor(type, options) {
this.onClick = this.onClick.bind(this);
this.type = type;
if (options == null) {
options = {};
}
this.options = options;
this.options = $.extend({}, this.constructor.defautOptions, this.options);
super(...arguments);
this.type = type;
this.options = $.extend({}, this.constructor.defaultOptions, options || {});
}
init() {

@ -10,10 +10,9 @@
*/
app.views.BasePage = class BasePage extends app.View {
constructor(el, entry) {
this.paintCode = this.paintCode.bind(this);
super(...arguments);
this.el = el;
this.entry = entry;
super(...arguments);
}
deactivate() {
@ -40,7 +39,9 @@ app.views.BasePage = class BasePage extends app.View {
this.delay(this.afterRender);
}
if (this.highlightNodes.length > 0) {
$.requestAnimationFrame(() => $.requestAnimationFrame(this.paintCode));
$.requestAnimationFrame(() =>
$.requestAnimationFrame(() => this.paintCode()),
);
}
}
@ -80,7 +81,7 @@ app.views.BasePage = class BasePage extends app.View {
}
if (this.highlightNodes.length > 0) {
$.requestAnimationFrame(this.paintCode);
$.requestAnimationFrame(() => this.paintCode());
}
this.previousTiming = timing;
}

@ -12,10 +12,9 @@ app.views.HiddenPage = class HiddenPage extends app.View {
}
constructor(el, entry) {
this.onClick = this.onClick.bind(this);
super(...arguments);
this.el = el;
this.entry = entry;
super(...arguments);
}
init() {

@ -11,11 +11,6 @@
//= require views/pages/base
app.views.JqueryPage = class JqueryPage extends app.views.BasePage {
constructor(...args) {
this.onIframeLoaded = this.onIframeLoaded.bind(this);
super(...args);
}
static initClass() {
this.demoClassName = "_jquery-demo";
}
@ -24,6 +19,7 @@ app.views.JqueryPage = class JqueryPage extends app.views.BasePage {
// Prevent jQuery Mobile's demo iframes from scrolling the page
for (var iframe of Array.from(this.findAllByTag("iframe"))) {
iframe.style.display = "none";
this.onIframeLoaded = this.onIframeLoaded.bind(this);
$.on(iframe, "load", this.onIframeLoaded);
}

@ -9,11 +9,6 @@
//= require views/pages/base
app.views.SqlitePage = class SqlitePage extends app.views.BasePage {
constructor(...args) {
this.onClick = this.onClick.bind(this);
super(...args);
}
static initClass() {
this.events = { click: "onClick" };
}

@ -13,24 +13,6 @@
let SEARCH_PARAM = undefined;
let HASH_RGX = undefined;
app.views.Search = class Search extends app.View {
constructor(...args) {
this.focus = this.focus.bind(this);
this.autoFocus = this.autoFocus.bind(this);
this.onWindowFocus = this.onWindowFocus.bind(this);
this.onReady = this.onReady.bind(this);
this.onInput = this.onInput.bind(this);
this.searchUrl = this.searchUrl.bind(this);
this.google = this.google.bind(this);
this.stackoverflow = this.stackoverflow.bind(this);
this.duckduckgo = this.duckduckgo.bind(this);
this.onResults = this.onResults.bind(this);
this.onEnd = this.onEnd.bind(this);
this.onClick = this.onClick.bind(this);
this.onScopeChange = this.onScopeChange.bind(this);
this.afterRoute = this.afterRoute.bind(this);
super(...args);
}
static initClass() {
SEARCH_PARAM = app.config.search_param;
@ -64,13 +46,15 @@
this.addSubview((this.scope = new app.views.SearchScope(this.el)));
this.searcher = new app.Searcher();
this.searcher.on("results", this.onResults).on("end", this.onEnd);
this.searcher
.on("results", (results) => this.onResults(results))
.on("end", () => this.onEnd());
this.scope.on("change", this.onScopeChange);
this.scope.on("change", () => this.onScopeChange());
app.on("ready", this.onReady);
$.on(window, "hashchange", this.searchUrl);
$.on(window, "focus", this.onWindowFocus);
app.on("ready", () => this.onReady());
$.on(window, "hashchange", () => this.searchUrl());
$.on(window, "focus", (event) => this.onWindowFocus(event));
}
focus() {
@ -247,7 +231,7 @@
if (context.hash) {
this.delay(this.searchUrl);
}
$.requestAnimationFrame(this.autoFocus);
$.requestAnimationFrame(() => this.autoFocus());
}
extractHashValue() {

@ -33,15 +33,8 @@
}
constructor(el) {
this.onResults = this.onResults.bind(this);
this.reset = this.reset.bind(this);
this.doScopeSearch = this.doScopeSearch.bind(this);
this.onClick = this.onClick.bind(this);
this.onKeydown = this.onKeydown.bind(this);
this.onTextInput = this.onTextInput.bind(this);
this.afterRoute = this.afterRoute.bind(this);
this.el = el;
super(...arguments);
this.el = el;
}
init() {
@ -51,7 +44,7 @@
fuzzy_min_length: 2,
max_results: 1,
});
this.searcher.on("results", this.onResults);
this.searcher.on("results", (results) => this.onResults(results));
}
getScope() {

@ -9,16 +9,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.DocList = class DocList extends app.View {
constructor(...args) {
this.render = this.render.bind(this);
this.onOpen = this.onOpen.bind(this);
this.onClose = this.onClose.bind(this);
this.onClick = this.onClick.bind(this);
this.onEnabled = this.onEnabled.bind(this);
this.afterRoute = this.afterRoute.bind(this);
super(...args);
}
static initClass() {
this.className = "_list";
this.attributes = { role: "navigation" };
@ -44,7 +34,7 @@ app.views.DocList = class DocList extends app.View {
this.addSubview((this.listFold = new app.views.ListFold(this.el)));
this.addSubview((this.listSelect = new app.views.ListSelect(this.el)));
app.on("ready", this.render);
app.on("ready", () => this.render());
}
activate() {
@ -248,6 +238,7 @@ app.views.DocList = class DocList extends app.View {
$.stopEvent(event);
const doc = app.disabledDocs.findBy("slug", slug);
if (doc) {
this.onEnabled = this.onEnabled.bind(this);
app.enableDoc(doc, this.onEnabled, this.onEnabled);
}
}

@ -11,13 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.DocPicker = class DocPicker extends app.View {
constructor(...args) {
this.onMouseDown = this.onMouseDown.bind(this);
this.onMouseUp = this.onMouseUp.bind(this);
this.onDOMFocus = this.onDOMFocus.bind(this);
super(...args);
}
static initClass() {
this.className = "_list _list-picker";
@ -34,6 +27,7 @@ app.views.DocPicker = class DocPicker extends app.View {
activate() {
if (super.activate(...arguments)) {
this.render();
this.onDOMFocus = this.onDOMFocus.bind(this);
$.on(this.el, "focus", this.onDOMFocus, true);
}
}

@ -18,14 +18,9 @@ app.views.Results = class Results extends app.View {
}
constructor(sidebar, search) {
this.onResults = this.onResults.bind(this);
this.onNoResults = this.onNoResults.bind(this);
this.onClear = this.onClear.bind(this);
this.afterRoute = this.afterRoute.bind(this);
this.onClick = this.onClick.bind(this);
super(...arguments);
this.sidebar = sidebar;
this.search = search;
super(...arguments);
}
deactivate() {
@ -39,9 +34,9 @@ app.views.Results = class Results extends app.View {
this.addSubview((this.listSelect = new app.views.ListSelect(this.el)));
this.search
.on("results", this.onResults)
.on("noresults", this.onNoResults)
.on("clear", this.onClear);
.on("results", (entries, flags) => this.onResults(entries, flags))
.on("noresults", () => this.onNoResults())
.on("clear", () => this.onClear());
}
onResults(entries, flags) {

@ -10,23 +10,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.Sidebar = class Sidebar extends app.View {
constructor(...args) {
this.resetHoverOnMouseMove = this.resetHoverOnMouseMove.bind(this);
this.resetHover = this.resetHover.bind(this);
this.showResults = this.showResults.bind(this);
this.onReady = this.onReady.bind(this);
this.onScopeChange = this.onScopeChange.bind(this);
this.onSearching = this.onSearching.bind(this);
this.onSearchClear = this.onSearchClear.bind(this);
this.onFocus = this.onFocus.bind(this);
this.onSelect = this.onSelect.bind(this);
this.onClick = this.onClick.bind(this);
this.onAltR = this.onAltR.bind(this);
this.onEscape = this.onEscape.bind(this);
this.afterRoute = this.afterRoute.bind(this);
super(...args);
}
static initClass() {
this.el = "._sidebar";
@ -51,14 +34,16 @@ app.views.Sidebar = class Sidebar extends app.View {
this.addSubview((this.search = new app.views.Search()));
this.search
.on("searching", this.onSearching)
.on("clear", this.onSearchClear)
.scope.on("change", this.onScopeChange);
.on("searching", () => this.onSearching())
.on("clear", () => this.onSearchClear())
.scope.on("change", (newDoc, previousDoc) =>
this.onScopeChange((newDoc, previousDoc)),
);
this.results = new app.views.Results(this, this.search);
this.docList = new app.views.DocList();
app.on("ready", this.onReady);
app.on("ready", () => this.onReady());
$.on(document.documentElement, "mouseleave", () => this.hide());
$.on(document.documentElement, "mouseenter", () =>
@ -85,13 +70,14 @@ app.views.Sidebar = class Sidebar extends app.View {
if (options.forceNoHover !== false && !this.hasClass("no-hover")) {
this.addClass("no-hover");
this.resetHoverOnMouseMove = this.resetHoverOnMouseMove.bind(this);
$.on(window, "mousemove", this.resetHoverOnMouseMove);
}
}
resetHoverOnMouseMove() {
$.off(window, "mousemove", this.resetHoverOnMouseMove);
return $.requestAnimationFrame(this.resetHover);
return $.requestAnimationFrame(() => this.resetHover());
}
resetHover() {

@ -26,19 +26,11 @@ app.views.SidebarHover = class SidebarHover extends app.View {
}
constructor(el) {
this.position = this.position.bind(this);
this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
this.onMouseover = this.onMouseover.bind(this);
this.onMouseout = this.onMouseout.bind(this);
this.onScroll = this.onScroll.bind(this);
this.onClick = this.onClick.bind(this);
this.onRoute = this.onRoute.bind(this);
super(...arguments);
this.el = el;
if (!isPointerEventsSupported()) {
delete this.constructor.events.mouseover;
}
super(...arguments);
}
show(el) {

@ -21,10 +21,8 @@ app.views.TypeList = class TypeList extends app.View {
}
constructor(doc) {
this.onOpen = this.onOpen.bind(this);
this.onClose = this.onClose.bind(this);
this.doc = doc;
super(...arguments);
this.doc = doc;
}
init() {

@ -174,6 +174,7 @@ app.View = class View {
if (this.constructor.events) {
for (name in this.constructor.events) {
method = this.constructor.events[name];
this[method] = this[method].bind(this);
this.onDOM(name, this[method]);
}
}
@ -181,6 +182,7 @@ app.View = class View {
if (this.constructor.routes) {
for (name in this.constructor.routes) {
method = this.constructor.routes[name];
this[method] = this[method].bind(this);
app.router.on(name, this[method]);
}
}
@ -188,6 +190,7 @@ app.View = class View {
if (this.constructor.shortcuts) {
for (name in this.constructor.shortcuts) {
method = this.constructor.shortcuts[name];
this[method] = this[method].bind(this);
app.shortcuts.on(name, this[method]);
}
}

Loading…
Cancel
Save