question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is there an "always" function?

See original GitHub issue

I want to execute when either a .then or a .catch is called. Typically this is handled with a .always

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
dgrahamcommented, Oct 17, 2015
var done = function(response) { console.log('response', response) }
var fail = function(error) { console.log('error', error) }
var always = function() { console.log('always') }
Promise.resolve(42).then(done).catch(fail).then(always, always)
1reaction
leorojas86commented, Jan 28, 2018

I did this:

class Platform {
  static init() {
    if(!Promise.prototype.finally) {//.finally is not supported by promise for iOS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally
      Promise.prototype.finally = function(callback) {
        return this.then(callback)
          .catch(callback);
      };
    }
  }
}

and just called Platform.init() from the application, now I can use .finally for promises as normal on iOS 😃.

Read more comments on GitHub >

github_iconTop Results From Across the Web

deferred.always() | jQuery API Documentation
A function, or array of functions, that is called when the Deferred is resolved or rejected. alwaysCallbacks. Type: Function(). Optional additional functions, ...
Read more >
Verilog always block - ChipVerify
An always block is one of the procedural blocks in Verilog. Statements inside an always block are executed sequentially.
Read more >
Sequential Verilog - Washington
Compiler will fail if function does not generate a result. ⇒ If you build a function wrong the circuit will not synthesize. If...
Read more >
Verilog always Block - Javatpoint
In Verilog, the always block is one of the procedural blocks. Statements inside an always block are executed sequentially.
Read more >
Verilog: always @ Blocks - Class Home Pages
This always@ block turns B, C, and D into A. Blocking assignments are used when specifying combinational logic (see Section 1.5). 1.4 always@( ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found