Skip to content
Verified Commit e254bf30 authored by ivan tkachenko's avatar ivan tkachenko 🗯
Browse files

lookandfeel: Fix Logout actions

JavaScript doesn't work that way: functions are only bound to a
left-hand-side object when immediately invoked via parenthesis, so the
previous code complained about wrong `this` object being bound to a QML
method at runtime. To fix this, store a closure in currentAction
instead of an unbound method.  Conversely, when calling a stored
function an extra pair of parenthesis should be preferred which resets
the execution context, to indicate that is not an instance method;
though not strictly required because:

> arrow functions establish `this` based on the scope the arrow function
> is defined within, and the `this` value does not change based on how
> the function is invoked.

(c) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Aside from that JS technicality, let's port LogoutButton away from
having an action property at all, since they already do have a signal
called clicked().
parent 2c37ef1e
Pipeline #545880 passed with stage
in 15 minutes and 49 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment