@osimatic/helpers-js 1.1.22 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/form_helper.js +10 -4
  2. package/package.json +1 -1
package/form_helper.js CHANGED
@@ -101,20 +101,26 @@ class FormHelper {
101
101
  }
102
102
 
103
103
  static setOnInputChange(input, callback, doneTypingInterval) {
104
- //setup before functions
105
- let typingTimer; //timer identifier
104
+ // setup before functions
105
+ let typingTimer; // timer identifier
106
106
  doneTypingInterval = typeof doneTypingInterval != 'undefined' && null !== doneTypingInterval ? doneTypingInterval : 700; // time in ms
107
107
 
108
- //on keyup, start the countdown
108
+ // on keyup, start the countdown
109
109
  input.on('keyup', function () {
110
110
  clearTimeout(typingTimer);
111
111
  typingTimer = setTimeout(callback, doneTypingInterval);
112
112
  });
113
113
 
114
- //on keydown, clear the countdown
114
+ // on keydown, clear the countdown
115
115
  input.on('keydown', function () {
116
116
  clearTimeout(typingTimer);
117
117
  });
118
+
119
+ // on focusout, clear the countdown and call callback
120
+ input.on('focusout', function () {
121
+ clearTimeout(typingTimer);
122
+ callback();
123
+ });
118
124
  }
119
125
 
120
126
  // ------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"