Skip to content

Instantly share code, notes, and snippets.

View monostere0's full-sized avatar

Daniel monostere0

  • Amsterdam, Netherlands
View GitHub Profile
@monostere0
monostere0 / es6_xhr.js
Last active August 29, 2015 14:13
XHR using ES6 Promise
var xhr = function(x, y, z) {
var a;
return new Promise(function(o, p) {
with(a = new XMLHttpRequest) open(y || "GET", x), send(z || null), onload = function(n) {
o(n.target.responseText)
}, onerror = p
})
};
//usage:
@monostere0
monostere0 / GlobalEvents.js
Last active February 19, 2020 08:10
Fire events between different browser windows using localStorage.
(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,