Skip to content

Instantly share code, notes, and snippets.

@rogerhnn
rogerhnn / README.md
Created March 13, 2022 02:35 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
var canvasimage = document.createElement('img');
canvasimage.crossOrigin = "Anonymous";
canvasimage.setAttribute('src', image)
canvasimage.addEventListener('load', function () {
const canvas = document.createElement('canvas');
const size = 16;
const maxPaletteSize = 10;
const context = canvas.getContext('2d');
const pixelArray = []; // Contains arrays of [red, green, blue, freqency]
const palette = []; // Contains arrays of [red, green, blue]