@uppy/companion
Version:
OAuth helper and remote fetcher for Uppy's (https://uppy.io) extensible file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox and Google Drive, S3 and more :dog:
18 lines (17 loc) • 601 B
JavaScript
;
const nodeEmitter = require('./default-emitter');
const redisEmitter = require('./redis-emitter');
let emitter;
/**
* Singleton event emitter that is shared between modules throughout the lifetime of the server.
* Used to transmit events (such as progress, upload completion) from controllers,
* such as the Google Drive 'get' controller, along to the client.
*/
module.exports = (redisClient, redisPubSubScope) => {
if (!emitter) {
emitter = redisClient
? redisEmitter(redisClient, redisPubSubScope)
: nodeEmitter();
}
return emitter;
};