0

I have a object like this

Dropzone.options.dropzoneForm = {
  addRemoveLinks: true,
  init: function () {
    //upload process
  }
}; 

from another method, I can create a object of this class and pass parameter like

myDropzone = new dropzoneForm();
myDropzone.addRemoveLinks = false; //something like this works perfectly. 

But I need to achieve another thing like

myDropzone.removedFile: function(){
//do something}

How can I achieve this, please suggest me.

4
  • 1
    Hi Sam, please try to rephrase your questions of what you are having issues with. Your question is not 100% clear. What is the issue exactly with removeFile you cannot make happen? Maybe give an example of what you've tried? Commented Apr 13, 2020 at 5:21
  • You do not need to do new. dropzoneForm is a object literal and not a class. Either set it as a constructor or directly consume the object Commented Apr 13, 2020 at 5:24
  • May be this can help. stackoverflow.com/a/39419794/4903314 stackoverflow.com/a/13522017/4903314 Commented Apr 13, 2020 at 5:24
  • Something like. myDropzone.prototype.removedFile: function(){ //do something} Commented Apr 13, 2020 at 5:25

2 Answers 2

2

If you want to add this method to dropzoneForm use prototype but if you want to add this method to myDropzone you can do this easily :

myDropzone.removedFile = function(){
};
Sign up to request clarification or add additional context in comments.

Comments

0

Use prototype to add method to your Object

dropzoneForm.prototype.removedFile = function(){
    // do something
}
var inst = new dropzoneForm();
inst.removedFile();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.