Skip to content

Instantly share code, notes, and snippets.

View SaladHut's full-sized avatar
🌴
On vacation

SaladHut Ko Pha-ngan SaladHut

🌴
On vacation
View GitHub Profile
@SaladHut
SaladHut / README.md
Last active July 17, 2022 11:55
Toast example made with litElement

Toast webcomponent example, MLIResume is in another gist. Substitute with your own choice of Promise solution. You can pop any lit html-tagged template literal or DOM element as long as it know to remove() itself.

  @query('#toaster') toaster;

  _testToast( title, body, icon, col, bg, timeout = 0 ){
    const toastRequest = new CustomEvent(
      'toast-notification',
      {
        bubbles: true,
@SaladHut
SaladHut / MLIData.js
Last active June 23, 2022 19:35
WIP firestore real time class wrapper
import { getFirestore, collection, doc, getDocs, setDoc, addDoc, updateDoc, getDoc, onSnapshot } from 'firebase/firestore';
import { getAuth, onAuthStateChanged } from 'firebase/auth';
import merge from 'deepmerge';
import { notEqual, isPlainObject } from '../functions';
import { MLIResume as Resume } from '../task';
import { MLIResourceType } from './MLIResourceType';
import { MLIDataProperty as DataProperty } from './MLIDataProperty';
function makeSetArray( array ){
@SaladHut
SaladHut / MLITask.js
Last active May 27, 2022 05:11
A simple task manager with with concurrency support.
import { MLITaskGroup } from './MLITaskGroup';
//import { MLIResume } from './MLIResume';
//FIXME Use MLIResume to update progress.
export class MLITask {
static status = {
INITIAL: 0,
QUEUED: 1,
STARTED: 2,
RESOLVED: 3,
@SaladHut
SaladHut / MLIResume.js
Last active July 19, 2022 02:19
A class utility for regenerating reusable Promise-like behaviors.
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
WTFPL Version 1.060377, March 2021
Copyright © 2021 SaladHut Resort <info@saladhut.com>
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. DO WHAT THE FUCK YOU WANT TO.
*/
export class MLIResume {