change mani.js to use promise