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.
1,126
questions
0
votes
1
answer
24
views
Flutter Failed to build appbundle when using DeferredComponent
I'm using DeferredComponent in my Flutter project. The app run successfully in debug and release mode. However, when I try to make an appbundle, the Deferred Components validation fails with the ...
0
votes
0
answers
17
views
Again Facebook Deferred link always return nil
After asking ATTrackingManager.requestTrackingAuthorization with an authorized status and then ask for AppLinkUtility.fetchDeferredAppLink always it return nil with this strange error:
...
2
votes
0
answers
39
views
g._defer.fn cannot affect g._defer in runtime.gopanic?
I am confused about this part of runtime.gopanic. Below is my test golang code and its plan9 compilation.
package main
func main() {
a := func() {
b := func() {
recover()
...
0
votes
1
answer
55
views
Pass pointer to go defer function doesn't work [duplicate]
In my code I try to use numAddr to record the change of num after the defer statement
func deferRun() {
num := 1
numAddr := &num
defer fmt.Printf("num is %d", *numAddr)
...
1
vote
1
answer
42
views
How to call deferred functions on SIGINT handling in Go
Is there a way to call the deferred functions in the signal handler function instead of re-implement it manually ?
Here is an example with multiple steps that take time where I tried to call the defer ...
-1
votes
1
answer
74
views
How to slow down the execution of code for popup blocker
I've been working on an issue with my program executing too quickly to detect whether popup is being blocked by the browser. Even with the timeout, sometimes the window that is opened doesn't get ...
-1
votes
0
answers
14
views
Gale Shapley Algorithm when women can reject once
There are 4 men and 4 women. Men propose to women.
The women are using deferred acceptance but where they can defer only
ONCE, that is, if they get a proposal in one round, they must make a decision
...
-1
votes
1
answer
51
views
Swift defer statements internals
Lets assume very simple example:
func square() -> Int {
var x = 5
defer { x = 10 }
return x
}
Why 5 is returned?
We know that defer is able to work only until rbp is vanished. So defer ...
0
votes
1
answer
78
views
Why this program prints 421 in result?
I can't to understand, why this program prints 421 instead of 431?
package main
import "fmt"
var x int
func f() int {
x++
return x
}
func main() {
o := fmt.Println
defer ...
0
votes
1
answer
68
views
Issue with Native promise resolve outside the function
I am trying to refactor jQuery promises with native promise for the below codes.
public functionA(){
const dArray = Array<JQueryDeferred<{a:string}>>=[];
//other lines of logic
...
0
votes
1
answer
27
views
How to properly use jQuery Deferred inside of a loop
I'm trrying to call a function that loops through a dataset and updates values in that dataset from data that comes from an asynchronous function. I obviously need to know when that function completes ...
0
votes
0
answers
169
views
Uncaught TypeError: Cannot read properties of undefined (reading 'deferred')
I am trying to make a panel in wordpress, with wp.customize wordpress object but i got this error.
Uncaught TypeError: Cannot read properties of undefined (reading 'deferred')
(function ($, api) {
...
0
votes
2
answers
69
views
How to resolve all async deferred nested values of a lazy initializable data structure?
I'm looking for vocabulary or for a library that supports the following behaviour:
Imagine a Javascript object like the following one:
const foo = {
id: 1,
name: 'Some String value',
supplier: ...
0
votes
1
answer
25
views
Is there a percieved performance gain combining javascript defer and placing at end of body?
Current coding standard seems to suggest putting included javascript -tags in the header and setting the defer attribute. This lets the html parse while the script is loading, which is good. But I was ...
0
votes
1
answer
80
views
Does async and defer also work for inline JS in script tags?
I understand defer and async when a JS-file is involved, but has it the same effect when I add inline js?
If so, I would expect the same result for both examples.
<script async >
doStuff();
&...
0
votes
0
answers
11
views
How should I know if my Molla theme has script designed to work with the async or defer attributes?
I am trying to optimize my site, and tests show me recommendations to add async or defer attributes.
But I found that this change could crush my site, so I need to find out if my Molla theme (from ...
-3
votes
1
answer
131
views
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 ...
0
votes
3
answers
113
views
Is there a way to call a deferred implementation in Java?
I'm not sure if the terminology is exactly correct here.
I have a class with some static methods that are called by several other classes in some library code written long ago.
The class with the ...
0
votes
0
answers
82
views
Why does video duration doesn't always appear in JavaScript after refresh?
I have a playlist of videos made with video.js and JavaScript (to automatically play next video, to view each video duration, and so on..)
The videos durations appear correctly, but most of the times, ...
0
votes
0
answers
76
views
why does JavaScript doesn't run correctly at refresh?
I have a video playlist made with video.js and JavaScript.
I added a js file duration.js to show the length of each video in the playlist and it works.
but most of the time, if I refresh the page, the ...
2
votes
2
answers
1k
views
Deferred evaluation of github.com/rs/zerolog Fields
Introduction
zerolog fields
I'm using github.com/rs/zerolog in my golang project.
I know that I can add fields to the output by using something like this:
package main
import (
"os"
...
-1
votes
2
answers
123
views
Javascript and HTML defer tag not working
The Javascript function below works perfectly when at the bottom of html file. However, I need it in main.js file. It has been suggested that adding the defer tag to the script tag will enable this ...
1
vote
0
answers
141
views
How to import a Flutter package (plugin - with a native implementation) to the Flutter project as a Deferred Component?
To reduce the size of my app, I implemented a part of my project as a separate plugin and I aimed to import it into the project as a Deferred components (like Play Feature Delivery). But since the ...
0
votes
2
answers
444
views
Getting a List from Coroutines
I try to make a method that would get a list of movies from database using coroutine and would return me that list.
But as you know coroutine returns Deferred, not a list, so I have a problem here.
...
0
votes
1
answer
51
views
Is the `runtime.deferreturn` ever called in go defer
At the bottom of a Go func with defer, the assembly looks like this:
0x000000000047e1a0 <+256>: callq *%rsi
0x000000000047e1a2 <+258>: movb $0x0,0x7(%rsp)
...
2
votes
1
answer
155
views
When to use defer_lock on std::shared_lock?
I see from cppreference:
std::shared_lock<Mutex>::shared_lock
C++ Thread support library std::shared_lock
shared_lock() noexcept;
(1) (since C++14)
shared_lock( shared_lock&& other ) ...
0
votes
0
answers
64
views
How to load external js to inline javascript
i have question and i hope u can help me to solved this.
i want to load external ajax recent post to inline script on my blogger, but its doesnt work..
<script>/*<![CDATA[*/ Defer.js('...
2
votes
1
answer
288
views
Using deferred libraries with variables
Sorry in advance I am a beginner and my English is approximate.
I don't know if what I'm doing is correct or not so sorry (again) if this sounds stupid to you.
I try to recover the contents of certain ...
1
vote
1
answer
81
views
can I omit defer keyword in this case?
go func() {
defer wg.Done()
for i := 0; i < n; i++ {
ch <- i
}
}()
go func() {
for i := 0; i < n; i++ {
ch <- i
}
...
0
votes
0
answers
174
views
Purpose of deferring a closure with file.Close
While reading the source code of Go program for dealing with program memory I found this snippet of code:
f, err := p.openFile("mem")
if err != nil {
return nil, err
}
defer func() { _ = ...
0
votes
0
answers
83
views
Angular script bundles have defer, but are added at end of the body
Why does angular adds the scripts (script bundles) to the document body instead of the head ?
There doesn't seems to be any gain achieved by such use of defer. Pls see the snapshot for the generated ...
-2
votes
1
answer
521
views
Why golang can not recover from a panic in a function called by the defer function [duplicate]
package main
import "fmt"
func myRecover() {
if r := recover(); r != nil {
fmt.Println(r)
}
}
func main() {
defer func() {
myRecover()
}()
panic("...
0
votes
1
answer
78
views
Load iframe after click or when appear
I need to optimize my website to PageSpeedInsight and I would like load an iframe only after click or when appear on the screen.
I have test many scripts but MapsAPI is always load when I test with ...
-2
votes
2
answers
91
views
Is there a method/function in JS that fires promises one by one, synchronously? [duplicate]
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<any> =...
0
votes
1
answer
430
views
Have the kotlin invoke() function return a Deferred from Coroutine
The invoke function allows a function to be called directly from the class.
How can I get this to work with a Coroutine Deferred result?
I have tried below but am getting Type mismatch Required: ...
0
votes
0
answers
98
views
how to embed onedrive image in website as deferred
I have embedded an image in my website from Microsoft one drive but problem is that image is in webP format but the embed code has not had this format. Moreover, I want to defer this image but don't ...
2
votes
1
answer
1k
views
Unity - How to hide Homebar on iOS ( defer system gestures and hide home button )
The game is in landscape mode and at the bottom of the screen are some ui buttons, for this reason I would need to hide iPhone home bar and use deferred edges.
Using "Hide home button on iPhone ...
2
votes
1
answer
366
views
Golang 'defer' causing delay in sending(receiving) API response
I have created an API, which after processing the request sends a response and starts a background goroutine which logs some messages. I have used 'defer' to execute goroutine after the API request ...
1
vote
0
answers
153
views
Is there have any solution to Defer Offscreen Image that used for div Background Image?
I'm using an image for div background image and lighthouse warning me for deferring offscreen image. This is my code and Is anyone can say, how can I defer this image with this code?
<div class=&...
1
vote
1
answer
216
views
Async multiple download with retrofit get the data in response
Lets say that i have a model
data class PendingFile(segment: Int, fileHash: String, url: String)
So when i have a list with pendingFiles i want to download each file concurrently.
private suspend fun ...
-3
votes
1
answer
373
views
'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 ...
0
votes
1
answer
52
views
Why did Xcode warn me about making this a constant, and why does it still change?
Within my updateBlob function, Xcode warned me that pos is unchanged and should be changed to a let constant, even though I can see that it's being changed, and running the program does indeed change ...
2
votes
1
answer
240
views
How to change jquery Deferred to use Vue nexttick?
I need to change this as I have read nextTick is a better option compared to deferred.
This is the original code that works well:
methods: {
...mapActions(['fetchOverdraftLogs', '...
0
votes
1
answer
469
views
Running a js function in html while the script tag has a defer attribute set
I the defer attribute of the script tag in the <head> section of HTML files. This almost always means that I cannot run js functions in the HTML since the js file is only loaded after the HTML ...
-1
votes
1
answer
95
views
Unit Test for twisted addCallback with nested method
I have a situation to write a unit test for the below code, please help me out here.
def method1(self):
self.method2()
def method2(self):
def method2_success(result):
if ...
0
votes
2
answers
208
views
jQuery: 1 ajax request and one function: pass parameters to function
I have a button click event where I execute multiple steps. Step one is an ajax request and the second step is calling a function passing the button name as a parameter. How do I accomplish this?
...
0
votes
0
answers
39
views
jquery .when function not trigger
In the following function, the $.when() never triggers. It goes right to the .then().
None of the console.log statements within that function fire, nor does the ajax query when it meets the criteria ...
0
votes
2
answers
655
views
Flutter Deferred Not Loaded Error was thrown
I would like to test functions, widgets etc. from lazy loaded packages. I'm using Dart’s deferred imports to shrink the main.dart.js file.
For example: import 'package:spitch/app/splashscreen.dart' ...
1
vote
1
answer
161
views
Alternatives to Deferred (anti?-)pattern when awaiting for user interactions in Angular
I'm building a game using Angular which has the following mechanics:
An Angular service checks the game state and requests a required user interaction.
A mediator service creates this request and ...
-2
votes
2
answers
422
views
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....