js: add dfd onto promise