Code: Select all
import { MyExistingClass1 } from './MyExistingModule.js'
const PNG = png.PNG;
class MyNewClass {
#myPng;
constructor() {
this.#myPng = new PNG();
// Do things that a MyNewClass does.
}
}
Code: Select all
import { PNG } from 'pngjs/browser'
class SomeThirdClass {
// Actual code replaced with a trivial example for illustration purposes.
makeNewPng(w, h) {
const newPng = new PNG();
newPng.width = w;
newPng.height = h;
// Do things that a SomeThirdClass does.
}
}
Code: Select all
// How do I "import" pngjs here so that it works in both environments? Or at least doesn't interfere with the web CDN version?
class MyExistingClass {
static ignoreScaleMisalignmentErrors = false;
static suggestedMaximumTileSheetColorCount = 8;
static get CURRENT_VERSION() { return ("1.0.0") };
}
Mobile version