Changeset 194573 in webkit
- Timestamp:
- Jan 4, 2016 10:32:28 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r194572 r194573 1 2016-01-04 Devin Rousso <dcrousso+webkit@gmail.com> 2 3 Web Inspector: Add debounce to URL inputs in the Visual sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=152655 5 6 Reviewed by Joseph Pecoraro. 7 8 Adding a debounce to url() based Visual sidebar editors will prevent needless 9 errors from being thrown as the user types, since incomplete URL's will not 10 be able to be located. 11 12 * UserInterface/Base/Utilities.js: 13 (Function.prototype.debounce): 14 Prevents the given function from executing more than once in the specified amount of time. 15 16 * UserInterface/Views/VisualStyleBackgroundPicker.js: 17 (WebInspector.VisualStyleBackgroundPicker): 18 19 * UserInterface/Views/VisualStyleURLInput.js: 20 (WebInspector.VisualStyleURLInput): 21 1 22 2016-01-04 Joseph Pecoraro <pecoraro@apple.com> 2 23 -
trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js
r194311 r194573 1108 1108 }); 1109 1109 1110 (function() { 1111 const debounceSymbol = Symbol("function-debounce-timeout"); 1112 Object.defineProperty(Function.prototype, "debounce", 1113 { 1114 value: function(delay, thisObject) 1115 { 1116 let callback = this.bind(thisObject); 1117 return function() { 1118 clearTimeout(callback[debounceSymbol]); 1119 let args = arguments; 1120 callback[debounceSymbol] = setTimeout(() => { 1121 callback.apply(null, args); 1122 }, delay); 1123 }; 1124 } 1125 }); 1126 })(); 1127 1110 1128 function appendWebInspectorSourceURL(string) 1111 1129 { -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleBackgroundPicker.js
r192705 r194573 44 44 this._valueInputElement.type = "url"; 45 45 this._valueInputElement.placeholder = WebInspector.UIString("Enter a URL"); 46 this._valueInputElement.addEventListener("input", this._valueInputValueChanged. bind(this));46 this._valueInputElement.addEventListener("input", this._valueInputValueChanged.debounce(250, this)); 47 47 this.contentElement.appendChild(this._valueInputElement); 48 48 -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js
r194504 r194573 33 33 this._urlInputElement.type = "url"; 34 34 this._urlInputElement.placeholder = WebInspector.UIString("Enter a URL"); 35 this._urlInputElement.addEventListener("keyup", this._valueDidChange. bind(this));35 this._urlInputElement.addEventListener("keyup", this._valueDidChange.debounce(250, this)); 36 36 this.contentElement.appendChild(this._urlInputElement); 37 37 }
Note: See TracChangeset
for help on using the changeset viewer.