grabHelper: Add (promised-based) grabAsync()
Some GrabHelper uses are in the form: doPreGrabStuff(); this._grabHelper.grab({ onUngrab: () => { undoPreGrabStuff(); }, }); A promise-based variant allows to write this more cleanly as: doPreGrabStuff(); await this._grabHelper.grabAsync(); undoPreGrabStuff(); https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/903
This commit is contained in:
parent
35494f5d08
commit
93fa1034f5
@ -194,6 +194,15 @@ var GrabHelper = class GrabHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
grabAsync(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
params.onUngrab = resolve;
|
||||
|
||||
if (!this.grab(params))
|
||||
reject(new Error('Grab failed'));
|
||||
});
|
||||
}
|
||||
|
||||
_takeModalGrab() {
|
||||
let firstGrab = this._modalCount == 0;
|
||||
if (firstGrab) {
|
||||
|
Loading…
Reference in New Issue
Block a user