Skip to content

Instantly share code, notes, and snippets.

@fozzle
fozzle / sendbird-promisify.js
Last active May 27, 2016 20:01
Promisify Sendbird JS SDK
import sendbird from 'sendbird';
const promisifySendbird = (sendbirdFunc =>
(...args) => {
const lastArg = args[args.length - 1];
const opts = {};
if (lastArg && typeof lastArg === 'object') Object.assign(opts, args.pop());
return new Promise((resolve, reject) => {
const promiseOpts = Object.assign(opts, {
successFunc() {