Skip to content

Instantly share code, notes, and snippets.

View eshimischi's full-sized avatar
🏠
Working from home

eshimischi

🏠
Working from home
View GitHub Profile
@eshimischi
eshimischi / mutationObserver.js
Created September 21, 2021 20:15 — forked from Krelix/mutationObserver.js
Simple MutationObserver to understand the behaviour of DOM modifications for a specific AJAX library.
// Just a method to log NodeList content
var logChildrenModifications = function(type, array) {
if (array instanceof NodeList) {
for (var i = 0; i < array.length; i++) {
if (array.item(i) instanceof NodeList) {
logChildrenModifications(type, array.item(i));
} else {
console.log(type + ' ' + array.item(i).nodeName);
}
}
@eshimischi
eshimischi / esm-package.md
Created August 2, 2021 22:17 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.