environment: Add Math.clamp
The good old clamp function, now part of the Math family. Clamp is happy after so many years of loneliness. This is a strict implementation of the draft ECMAScript proposal. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1295
This commit is contained in:
@ -225,10 +225,6 @@ class Indicator extends PanelMenu.SystemIndicator {
|
||||
}
|
||||
});
|
||||
|
||||
function clamp(value, min, max) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
|
||||
var AppAuthorizer = class {
|
||||
constructor(desktopId, reqAccuracyLevel, permStoreProxy, maxAccuracyLevel) {
|
||||
this.desktopId = desktopId;
|
||||
@ -313,9 +309,8 @@ var AppAuthorizer = class {
|
||||
|
||||
_completeAuth() {
|
||||
if (this._accuracyLevel != GeoclueAccuracyLevel.NONE) {
|
||||
this._accuracyLevel = clamp(this._accuracyLevel,
|
||||
0,
|
||||
this._maxAccuracyLevel);
|
||||
this._accuracyLevel = Math.clamp(this._accuracyLevel,
|
||||
0, this._maxAccuracyLevel);
|
||||
}
|
||||
this._saveToPermissionStore();
|
||||
|
||||
|
Reference in New Issue
Block a user