Questions tagged [deferred]

Deferred objects simplify callback management in an asynchronous environment, mitigating the "Pyramid of Doom" that results from too many levels of nested callbacks.

Deferred objects simplify callback management in an asynchronous environment, mitigating the "Pyramid of Doom" that results from too many levels of nested callbacks. A deferred object exposes a promise as interface but internally keeps a system for changing the status of the promise.

Example libraries:

jQuery: http://api.jquery.com/jQuery.Deferred/
Node.js / Vanilla JS: https://github.com/kriskowal/q

1131 questions
-1
votes
1 answer

Angular js - resolving promises in routeProvider

I'm just trying resolving promises from a factory like this: .config(['$routeProvider', '$locationProvider', '$httpProvider', 'SoundRTCProvider', function ($routeProvider, $locationProvider, $httpProvider, SoundRTCProvider) { $routeProvider …
itsme
  • 48,972
  • 96
  • 224
  • 345
-1
votes
1 answer

Check whether a object is deferred or not?

I need to check whether a object is Deferred or not using Jquery, how to check that? Thanks in advance, Madhu
Madhu
  • 2,416
  • 3
  • 15
  • 33
-1
votes
1 answer

Twisted Python: how to make a deferred object that waits for data from child process?

In the method lineReceived in Echo protocol, I would like to generate a deferred object each time I write to child. It would wait for a result, and then print the result once the data is done being processed by the child process. I need to find a…
Squall Leohart
  • 657
  • 2
  • 8
  • 20
-1
votes
1 answer

GWT Reflection with deferred bindings GAE works in Firefox, not chrome, IE

i have a problem with deferred bindings. i created it like in this Blog: http://programmatica.blogspot.com/2007/10/classfornamefullyqualifiedclassnamenewi.html My code crashed at "GWT.create". But only when i run it on Google App Engine, and only in…
Sam
  • 2,707
  • 1
  • 23
  • 32
-2
votes
2 answers

Is there a method/function in JS that fires promises one by one, synchronously?

I mean, is there something like Promise.all, only where the methods are executed one after the other, in turn. Or is it left to make your own custom method? const getUsersIds = (): Promise => API.Users.getUsersIds().then(action((res) =>…
Lev Myndra
  • 33
  • 1
  • 9
-2
votes
2 answers

javascript promise resolve is not a function

I try to use a promise, but am unable to return a proper resolve object. my promise is: function retrievecount(id, type) { var dfrd = $.Deferred(); var hits = "the result"; dfrd.resolve(hits); return dfrd.promise(); } And I call…
David
  • 37
  • 4
-2
votes
2 answers

$.when.apply.done returns different results depending on whether the size of the array is one or many

I'm looking for a little advice regarding the best way to execute multiple ajax calls and then combine the results. My problem is that according to the documentation of the when function it will map the resulting argument differently when there are…
Jason Turan
  • 1,302
  • 12
  • 20
-2
votes
1 answer

Not able integrate deferred deep link in android app

Objective : I have 2 apps (Say A & B). Case 1: When app B is installed and I launch a page (say product page) on app A it will land to same product page of app B. Case 2: When app B is not present and I launched it from app A it will land to play…
-2
votes
2 answers

Why is defer block executed before a closure finishes in the same function

I wrote the following function to add a map annotation that uses CLGeocoder() to resolve the location name given a coordinate. I use a defer block to get the resolved location name. However, the defer block seems to finish before the closure…
TonyW
  • 18,375
  • 42
  • 110
  • 183
-2
votes
1 answer

jQuery Deferred - How to Abort A Long Running Request

My problem is that I need a way of aborting a deferred to stop errors occurring in my application. I have created a jsfiddle with a simple overview of my problem, which is that a done handler is trying to act on an element that has been removed…
Undefined
  • 11,234
  • 5
  • 37
  • 62
-2
votes
1 answer

JQuery deferreds resolving other deferreds

I have a function that pushes promises from other functions that are also resolving arrays of promises. I was just wondering if this code is OK. Here is the main function /// Process the validation results (invalid IDR records will have…
gdex
  • 465
  • 1
  • 4
  • 10
-3
votes
1 answer

How do I handle errors in a deferred function?

func someFunc() (err error) { defer func(err_ error) { r.handleErrOrPanic(err_, obj) }(err) // err is always nil here err = ThrowErrOrPanic(ctx, obj) return err } I would like to use handleErrOrPanic as a deferred function…
User12547645
  • 6,955
  • 3
  • 38
  • 69
-3
votes
1 answer

'return' cannot transfer control out of a defer statement

func someone() -> String { defer { return "World" } return "Hello" } someone() for above snippet of code its throwing error "'return' cannot transfer control out of a defer statement" so what is the reason behind it?
Vyankatesh
  • 139
  • 1
  • 10
-3
votes
1 answer

handling SIGINT (ctrl-c) in golang to convert it to a panic

My goal is to have a handler for SIGINT (i.e., Ctrl-C on the CLI) which will allow deferred function calls to run instead of causing a hard exit. The usecase for this is in a test suite with very long-running tests, I want the CLI user to be able to…
lachrimae
  • 79
  • 7
-3
votes
1 answer

Is there a native way to do deffered promises in Javascript in 2019?

This question here - from 2014 - outlines various ways to do a deferred promise: Resolve Javascript Promise outside function scope There is this MDN documentation about Deferred object does say that there is Promise.defer() - but that it is…
dwjohnston
  • 11,163
  • 32
  • 99
  • 194
1 2 3
75
76