Skip to content

Instantly share code, notes, and snippets.

View tonix-tuft's full-sized avatar

Anton Bagdatyev (Tonix) tonix-tuft

View GitHub Profile
@jasuperior
jasuperior / Promiser.js
Last active March 21, 2022 06:46
An ES6 async/promise proof of concept using Proxies.
/*
Using Es6 Proxies, I created an object that can resolve promises from a chained object accessor pattern.
simply await the values, or supply a callback to .then() and watch the magic.
*/
Symbol.queue = Symbol("queue"); //using Symbols to hide properties from being used or altered
Symbol.data = Symbol("data");
function Promiser( obj ) {
return new Proxy(obj, {
get(target, prop){