Pārlūkot izejas kodu

Use on instead of bind

Suggested by deepcode.ai.
Marc Hartmayer 5 gadi atpakaļ
vecāks
revīzija
52d633ca69
2 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 2 2
      client/lib/dropImage.js
  2. 1 1
      client/lib/pasteImage.js

+ 2 - 2
client/lib/dropImage.js

@@ -39,8 +39,8 @@
     };
     };
     return this.each(function() {
     return this.each(function() {
       const element = this;
       const element = this;
-      $(element).bind('dragenter dragover dragleave', stopFn);
-      return $(element).bind('drop', function(event) {
+      $(element).on('dragenter dragover dragleave', stopFn);
+      return $(element).on('drop', function(event) {
         stopFn(event);
         stopFn(event);
         const files = event.dataTransfer.files;
         const files = event.dataTransfer.files;
         for (let i = 0; i < files.length; i++) {
         for (let i = 0; i < files.length; i++) {

+ 1 - 1
client/lib/pasteImage.js

@@ -35,7 +35,7 @@
     options = $.extend({}, defaults, options);
     options = $.extend({}, defaults, options);
     return this.each(function() {
     return this.each(function() {
       const element = this;
       const element = this;
-      return $(element).bind('paste', function(event) {
+      return $(element).on('paste', function(event) {
         const types = event.clipboardData.types;
         const types = event.clipboardData.types;
         const items = event.clipboardData.items;
         const items = event.clipboardData.items;
         for (let i = 0; i < types.length; i++) {
         for (let i = 0; i < types.length; i++) {