jessquery
Version:
Modern JavaScript is pretty good, but typing document.querySelector() is a pain. This is a tiny library that makes DOM manipulation easy. jQuery is around 80kb (30kb gzipped), while this is only around 8kb (3.5kb gzipped). Lots of JSDoc comments so it's s
19 lines (15 loc) • 423 B
JavaScript
export let errorHandler = (error, context) => {
console.error(context, error)
}
export function setErrorHandler(handler) {
errorHandler = handler
}
export function giveContext(methodName, selector) {
const message =
methodName === "$"
? `$('${selector}')`
: methodName === "$$"
? `$$('${selector}')`
: `Method: ${methodName} called on: ${selector}`
return message
}