A js promise spec implementation