@osimatic/helpers-js 1.1.13 → 1.1.15

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.
package/form_helper.js CHANGED
@@ -100,6 +100,23 @@ class FormHelper {
100
100
  return textarea.val().replace(/(\r\n|\n|\r)/g, "\n").split("\n").filter(word => word.length > 0);
101
101
  }
102
102
 
103
+ static setOnInputChange(input, callback, doneTypingInterval) {
104
+ //setup before functions
105
+ let typingTimer; //timer identifier
106
+ doneTypingInterval = typeof doneTypingInterval != 'undefined' && null !== doneTypingInterval ? doneTypingInterval : 700; // time in ms
107
+
108
+ //on keyup, start the countdown
109
+ input.on('keyup', function () {
110
+ clearTimeout(typingTimer);
111
+ typingTimer = setTimeout(callback, doneTypingInterval);
112
+ });
113
+
114
+ //on keydown, clear the countdown
115
+ input.on('keydown', function () {
116
+ clearTimeout(typingTimer);
117
+ });
118
+ }
119
+
103
120
  // ------------------------------------------------------------
104
121
  // Select
105
122
  // ------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/paging.js CHANGED
@@ -143,6 +143,19 @@ class Navigation {
143
143
  let tab = new bootstrap.Tab(a[0]);
144
144
  tab.show();
145
145
  }
146
+
147
+ static addTabInHistory(tabId, queryStringKey, replace) {
148
+ queryStringKey = typeof queryStringKey != 'undefined' && null !== queryStringKey ? queryStringKey : 'tab';
149
+ replace = typeof replace != 'undefined' && null !== replace ? replace : true;
150
+ let url = window.location.href;
151
+ url = UrlAndQueryString.setParamOfUrl(queryStringKey, tabId, url);
152
+ if (replace) {
153
+ window.history.replaceState('', document.title, url);
154
+ }
155
+ else {
156
+ window.history.pushState("", "", newUrl);
157
+ }
158
+ }
146
159
  }
147
160
 
148
161
  module.exports = { Pagination, Navigation };