Skip to content

Instantly share code, notes, and snippets.

View fuzzypawzz's full-sized avatar

Jannik Maag fuzzypawzz

View GitHub Profile
@fuzzypawzz
fuzzypawzz / SVGConstructor.js
Created February 29, 2020 12:11
SVG Constructor
/**
* SVG ICON CONSTRUCTOR
* @constructor
* @param {string} svgId The reference ID for the SVG (for use with the 'use' svg)
* @param {string} className Class of the SVG's parent element
*/
function Svg(svgId, className) {
this.svgId = svgId;
this.className = className;
this.createSvg = function () {
@fuzzypawzz
fuzzypawzz / promise-cache.ts
Last active December 3, 2022 15:08
TypeScript Promise cache
import { v4 as uuidv4 } from 'uuid'
type CachedPromise = Promise<any>
type PromiseDetails = Record<string, unknown>
type PromiseId = string
type MatcherCallback = (args: PromiseDetails) => boolean
type ActionId = string
interface IPromiseDataModel {
id: PromiseId