Yurik has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/388677 )

Change subject: Use Promise.then() instead of non-standard done()
......................................................................

Use Promise.then() instead of non-standard done()

jquery already supports standard .then() / .catch(),
so lets use those instead of .done().

This change allows implementers to use proper ES6+ things
like async functions, which return standard promise.

Change-Id: If692d7f13d406bbcc75b22735f78749c6460def4
---
M embed.html
M wikibase/queryService/ui/App.js
2 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/77/388677/1

diff --git a/embed.html b/embed.html
index 5b98e78..2d48ca0 100644
--- a/embed.html
+++ b/embed.html
@@ -275,7 +275,7 @@
                                $( 'body' ).i18n();
                                $( 'html' ).attr( { lang: lang, dir: 
$.uls.data.getDir( lang ) } );
 
-                               resultView.draw( query ).done( function() {
+                               resultView.draw( query ).then( function() {
                                        $( '.logo' ).hide();
                                } );
                                renderEdit( query, function( q ){
diff --git a/wikibase/queryService/ui/App.js b/wikibase/queryService/ui/App.js
index d6ee0b7..f8a27c7 100644
--- a/wikibase/queryService/ui/App.js
+++ b/wikibase/queryService/ui/App.js
@@ -672,9 +672,13 @@
                this._updateQueryUrl();
 
                $( '#execute-button' ).prop( 'disabled', true );
-               this._resultView.draw( this._editor.getValue() ).fail( function 
( error ) {
-                       self._editor.highlightError( error );
-               } ).always( function () {
+               this._resultView.draw( this._editor.getValue() ).catch( 
function ( error ) {
+                       try {
+                               self._editor.highlightError(error);
+                       } catch ( err ) {
+                               // ignore
+                       }
+               } ).then( function () {
                        $( '#execute-button' ).prop( 'disabled', false );
                } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/388677
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If692d7f13d406bbcc75b22735f78749c6460def4
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik <yuriastrak...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to