implement part of function resolvePromise