This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReactiveVariable { | |
constructor(val, handle) { | |
if(typeof handle === 'function') { | |
this.Value = val; | |
this.Handle = handle; | |
} else console.error('ReactiveVariable needs a handler function after the value'); | |
return this.Value; | |
} | |
set(val) { | |
if(this.Value !== val) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
((doc,root) => { | |
let isArraylike = o => typeof o['length'] !== "undefined", | |
isFunc = o => typeof o === 'function'; | |
function omitFrom(Arr, ...values) { | |
if (values.length === 1) { | |
let temp = [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CSSRule(index, selector, rules, sheet) { | |
if (toString.call(rules) === '[object Object]') { | |
let temp = ''; | |
for(let key in rules) temp += key + ': ' + (rules[key].includes(';') ? rules[key] : rules[key] + ';\n'); | |
rules = temp | |
} | |
sheet.insertRule(selector + "{" + rules + "}", index) | |
} | |
function revokeCSSRule(index, sheet) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function animFrame(func) { | |
return new class { | |
constructor(fn) { | |
this.fn = fn | |
} | |
start() { | |
this.fn(); | |
this.interval = requestAnimationFrame(this.start.bind(this)); | |
return this | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function GetScript(loc) { | |
return new Promise((resolve, reject) => { | |
fetch(loc) | |
.then(res => res.text()) | |
.then(code => { | |
let script = document.createElement('script'); | |
script.src = URL.createObjectURL(new Blob([code])); | |
script.onload = resolve; | |
document.head.appendChild(script); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (root) { | |
let isFunc = o => typeof o === 'function', | |
isString = o => typeof o === 'string', | |
isObj = o => toString.call(o) === '[object Object]', | |
defineprop = Object.defineProperty; | |
function eventemitter(obj) { | |
let options = { | |
evtlisteners: new Set, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var plus = (a, b) => a + b; | |
var minus = (a, b) => a - b; | |
var divide = (a,b) => a / b; | |
var multiply = (a,b) => a * b; | |
var num = a => ({ | |
add(b) { | |
a = plus(a, b); | |
return this; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class eventSystem { | |
constructor() { | |
this.listeners = new Map; | |
} | |
hasListener(type,func) { | |
return this.listeners.has(type) && this.listeners.get(type).has(func); | |
} | |
addListener(type,func) { | |
if(!this.listeners.has(type)) this.listeners.set(type,new Set); | |
this.listeners.get(type).add(func); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const eventListener = (target, type, handle) => ({ | |
on(alt, options) { | |
if (typeof alt != "function") { | |
options = alt; | |
alt = null; | |
} | |
this.active = true; | |
this.options = options != undefined ? options : this.options || false; | |
if (target.addEventListener) target.addEventListener(type, alt || handle, this.options); | |
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const eventSystem = (obj = {}) => { | |
const listeners = new Map; | |
function makeHandle(type, func) { | |
const eventsys = this; | |
return { | |
off() { | |
eventsys.off(type, func); | |
return this; | |
}, | |
on() { |
OlderNewer