mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
launch js event when initializing dropzone
This commit is contained in:
parent
927d7e6e85
commit
7d87a45a55
@ -22,4 +22,5 @@ Version 1.5.3
|
||||
===============
|
||||
|
||||
- replace default message on download button below dropzone ;
|
||||
- launch event when dropzone is initialized, to allow to customize events on dropzone;
|
||||
|
||||
|
@ -2,6 +2,25 @@ var algo = 'AES-CBC';
|
||||
var Dropzone = require('dropzone');
|
||||
var initializeDownload = require('./downloader.js');
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* define a dropzone for chill usage
|
||||
*
|
||||
* An event is launched when dropzone is initialize, allowing to customize events
|
||||
* on dropzone :
|
||||
*
|
||||
* ```
|
||||
* window.addEventListener("chill_dropzone_initialized", (e) => {
|
||||
* // do something with dropzone:
|
||||
* e.detail.dropzone.on("success", (e) => {
|
||||
* // see https://www.dropzonejs.com/#event-success
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
// load css
|
||||
//require('dropzone/dist/basic.css');
|
||||
require('dropzone/dist/dropzone.css');
|
||||
@ -139,6 +158,14 @@ var initialize = function(zone) {
|
||||
zone.insertBefore(created, zone.firstChild);
|
||||
|
||||
insertDownloadButton(zone, zoneData);
|
||||
|
||||
let event = new CustomEvent("chill_dropzone_initialized", {
|
||||
detail: {
|
||||
dropzone: dropzoneI,
|
||||
zoneData: zoneData
|
||||
}
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
|
||||
var createFilename = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user