refactors Discourse.debouncePromise

continuation of this pull request: https://github.com/discourse/discourse/pull/1542 (completes debounce functionality refactoring)