chat-engine-uploadcare

Emits the $uploadCare.upload event when UploadCare completes an uplaod

Source:

require('chat-engine-uploadcare')()

Source:
<script>
  UPLOADCARE_LOCALE = "en";
  UPLOADCARE_TABS = "file url facebook gdrive dropbox instagram evernote flickr skydrive";
  UPLOADCARE_PUBLIC_KEY = "YOUR_UPLOADCARE_KEY";
</script>
<script charset="utf-8" src="//ucarecdn.com/libs/widget/2.10.3/uploadcare.full.min.js"></script>

<script src="dist/chat-engine-uploadcare.js" type="text/javascript"></script>
// initialize the UploadCare Widget
let widget = uploadcare.Widget('[role=uploadcare-uploader]');

// create a new ChatEngine Chat.
let chat = new ChatEngine.Chat('uploads');

// add the plugin to the Chat.
chat.plugin(ChatEngineCore.plugin['chat-engine-uploadcare']());

// bind the widget to the Chat.
chat.uploadcare.bind(widget);

Listen to upload events from the Chat.
chat.on('$uploadcare.upload', (payload) => {
    console.log('upload', payload.data.cdnUrl, 'from', payload.sender.uuid);
});
Example
Include the [Uploadcare](https://uploadcare.com) Javascript files and configure the widget. Check out the [Uploadcare Widget Docs](https://uploadcare.com/documentation/javascript_api/v2/) for more information.

Requires

Methods

(inner) uploadcare.bind()

Augments:
Source:

Bind a Chat to an Uploadcare widget. The Chat will then fire $uploadcare.upload events when Uploadcare detects and upload.

Events

$uploadcare.upload

Augments:
Source:

Fired when a user uploads a file via the Uploadcare widget.

Example
chat.on('$uploadcare.upload', (payload) => {
    console.log('upload', payload.data.cdnUrl, 'from', payload.sender.uuid);
});
Parameters:
Name Type Description
payload Object
Properties
Name Type Description
data Object

The Uploadcare fileInfo.