¡@

Home 

2014/10/16 ¤W¤È 12:06:36

jquery Programming Glossary: promise

Can somebody explain jQuery queue to me? [closed]

http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me

uses the .Deferred .queue and .ajax to also pass back a promise that is resolved when the request completes. Another version.. .ajaxQueue function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest.. function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest add the abort..

Sequencing ajax requests

http://stackoverflow.com/questions/3034874/sequencing-ajax-requests

uses the .Deferred .queue and .ajax to also pass back a promise that is resolved when the request completes. jQuery.ajaxQueue.. .ajaxQueue function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest.. function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest add the abort..

Client-side javascript to support promises, futures, etc

http://stackoverflow.com/questions/3249646/client-side-javascript-to-support-promises-futures-etc

side javascript to support promises futures etc I'm really interested in implementing Promises.. side This Sitepen article has some great information on promises in CommonJS but it is focused on SSJS. What other libraries.. on SSJS. What other libraries are available that implement promises that can easily work client side What are your impressions..

How can jQuery deferred be used?

http://stackoverflow.com/questions/4869609/how-can-jquery-deferred-be-used

set it to be an empty deferred object if deferred deferred.promise deferred .when if we have tasks left then handle the next.. the cached value or an jqXHR object which contains a promise return cache val .ajax ' foo ' data value val dataType 'json'..

jQuery deferreds and promises - .then() vs .done()

http://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done

deferreds and promises .then vs .done I've been reading about jQuery deferreds and.. vs .done I've been reading about jQuery deferreds and promises and I can't see the difference between using .then .done for.. Prior to jQuery 1.8 then was just syntactic sugar promise.then doneCallback failCallback was equivalent to promise.done..

JavaScript asynchronous return value / assignment with jQuery [duplicate]

http://stackoverflow.com/questions/7779697/javascript-asynchronous-return-value-assignment-with-jquery

allows you to make your own asynchronous logic return a promise which you can then attach any number of callbacks to function.. function guid dfd.resolve guid return dfd.promise example use trackPage .done function guid alert Got GUID guid.. Page GUID guid Also the jQuery AJAX module always returns promises as well so the interface for all your AJAX stuff should be..

How to chain ajax calls using jquery

http://stackoverflow.com/questions/8612894/how-to-chain-ajax-calls-using-jquery

self.deferred.resolve DeferredAjax.prototype.promise function return this.deferred.promise var countries US CA MX.. function return this.deferred.promise var countries US CA MX startingpoint .Deferred startingpoint.resolve.. http jsfiddle.net k8aUj 3 Each pipe call returns a new promise which is in turn used for the next pipe. Note that I only provided..

jQuery.ajax handling continue responses: “success:” vs “.done”?

http://stackoverflow.com/questions/8840257/jquery-ajax-handling-continue-responses-success-vs-done

done is that the return value of .ajax is now a deferred promise that can be bound to anywhere else in your application. So let's.. to change the xhr_get definition being sure to return a promise or at least a done method in the case of the example above ...

When should I use jQuery deferred's “then” method and when should I use the “pipe” method?

http://stackoverflow.com/questions/9583783/when-should-i-use-jquery-deferreds-then-method-and-when-should-i-use-the-pip

As of jQuery 1.8 the deferred.then method returns a new promise that can filter the status and values of a deferred through.. return value of ` .ajax .pipe ` which is a new deferred promise object and connected to the one returned by the callback passed..

Using jQuery with Windows 8 Metro JavaScript App causes security error

http://stackoverflow.com/questions/10859523/using-jquery-with-windows-8-metro-javascript-app-causes-security-error

is to use the WinJS features this includes the WinJS.Promise object as an alternative to deferred operations which are themselves.. operations which are themselves an implementation of the Promise pattern . And you can do some basic DOM manipulation using the.. about using jQuery for deferred operations. The WinJS.Promise object is used throughout the Metro APIs to represent async..

How do I do a jQuery blocking AJAX call without async = false?

http://stackoverflow.com/questions/11062803/how-do-i-do-a-jquery-blocking-ajax-call-without-async-false

ticket 11013#comment 40 The use of the Deferred Promise functionality in synchronous ajax requests has been deprecated.. but you must use a callback parameter rather than a Promise method such as .then or .done . So if you are using the success..

pipe() and then() documentation vs reality in jQuery 1.8

http://stackoverflow.com/questions/12011925/pipe-and-then-documentation-vs-reality-in-jquery-1-8

and up to date. I've been exploring the jQuery Deferred Promise API for a bit and I'm very confused about the differences between.. or they can return another observable object Deferred Promise etc which will pass its resolved rejected status and values..

Using JQuery Deferred and Promise

http://stackoverflow.com/questions/13384564/using-jquery-deferred-and-promise

JQuery Deferred and Promise I have a function that I want to use deferred and promise to.. objects with each other and create immediately resolved Promises for any other values like numbers. Therefore your done callback.. with Deferreds you can invoke the promise method to get a Promise for the queue's end. Example call '#ticker' .fadeOut .delay..

Wait until all jquery ajax request are done?

http://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-request-are-done

you can save the object returned by .when it's a jQuery Promise object encompassing all of the original ajax queries. You can..

jQuery.when - Callback for when ALL Deferreds are no long 'unresolved' (either resolved or rejected)?

http://stackoverflow.com/questions/5824615/jquery-when-callback-for-when-all-deferreds-are-no-long-unresolved-either-r

objects are passed to jQuery.when the method returns the Promise from a new master Deferred object that tracks the aggregate..

jQuery $.post deferred

http://stackoverflow.com/questions/6433696/jquery-post-deferred

jqXHR which is itself a deferred object it implements the Promise interface . So no need for .when . There is also no need to..

When should I use jQuery deferred's “then” method and when should I use the “pipe” method?

http://stackoverflow.com/questions/9583783/when-should-i-use-jquery-deferreds-then-method-and-when-should-i-use-the-pip

rejected. pipe deferred.pipe doneFilter failFilter Returns Promise doneFilter An optional function that is called when the Deferred.. difference between returning a Deferred and returning a Promise seems slight. I've read the official docs over and over but.. that can't be done with pipe due to it returning a new Promise jquery asynchronous jquery deferred decoupling jquery chaining..

Can somebody explain jQuery queue to me? [closed]

http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me

Queueing Ajax Calls I developed an .ajaxQueue plugin that uses the .Deferred .queue and .ajax to also pass back a promise that is resolved when the request completes. Another version of .ajaxQueue that still works in 1.4 is posted on my answer.. empty object we are going to use this as our Queue var ajaxQueue .ajaxQueue function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest add the abort method promise.abort function statusText proxy.. we are going to use this as our Queue var ajaxQueue .ajaxQueue function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest add the abort method promise.abort function statusText proxy abort to..

Sequencing ajax requests

http://stackoverflow.com/questions/3034874/sequencing-ajax-requests

question jQuery 1.5 I developed an .ajaxQueue plugin that uses the .Deferred .queue and .ajax to also pass back a promise that is resolved when the request completes. jQuery.ajaxQueue A queue for ajax requests c 2011 Corey Frang Dual licensed.. empty object we are going to use this as our Queue var ajaxQueue .ajaxQueue function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest add the abort method promise.abort function statusText proxy.. we are going to use this as our Queue var ajaxQueue .ajaxQueue function ajaxOpts var jqXHR dfd .Deferred promise dfd.promise queue our ajax request ajaxQueue.queue doRequest add the abort method promise.abort function statusText proxy abort to..

Client-side javascript to support promises, futures, etc

http://stackoverflow.com/questions/3249646/client-side-javascript-to-support-promises-futures-etc

side javascript to support promises futures etc I'm really interested in implementing Promises and related features in client side Javascript. From what I've.. solution. Is it possible to use the CommonJS solution client side This Sitepen article has some great information on promises in CommonJS but it is focused on SSJS. What other libraries are available that implement promises that can easily work.. great information on promises in CommonJS but it is focused on SSJS. What other libraries are available that implement promises that can easily work client side What are your impressions experience and feedback on any toolkit you have used I've found..

How can jQuery deferred be used?

http://stackoverflow.com/questions/4869609/how-can-jquery-deferred-be-used

deferred handler task if its not a deferred object then set it to be an empty deferred object if deferred deferred.promise deferred .when if we have tasks left then handle the next one when the current one is done. if tasks.length 0 deferred.done.. post on the topic var cache function getData val return either the cached value or an jqXHR object which contains a promise return cache val .ajax ' foo ' data value val dataType 'json' success function resp cache val resp .when getData 'foo'..

jQuery deferreds and promises - .then() vs .done()

http://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done

deferreds and promises .then vs .done I've been reading about jQuery deferreds and promises and I can't see the difference between using .then.. deferreds and promises .then vs .done I've been reading about jQuery deferreds and promises and I can't see the difference between using .then .done for successful callbacks. I know Eric Hynds mentions that .done.. attached to fail will be fired when the deferred is rejected. Prior to jQuery 1.8 then was just syntactic sugar promise.then doneCallback failCallback was equivalent to promise.done doneCallback .fail failCallback As of 1.8 then is an alias..

JavaScript asynchronous return value / assignment with jQuery [duplicate]

http://stackoverflow.com/questions/7779697/javascript-asynchronous-return-value-assignment-with-jquery

is tried and true &ndash however jQuery has .Deferred . This allows you to make your own asynchronous logic return a promise which you can then attach any number of callbacks to function trackPage var elqTracker new jQuery.elq 459 dfd .Deferred.. dfd .Deferred elqTracker.pageTrack success function elqTracker.getGUID function guid dfd.resolve guid return dfd.promise example use trackPage .done function guid alert Got GUID guid Notice now that your trackPage returns an object that you.. .click function pageHit.done function guid alert Clicked on Page GUID guid Also the jQuery AJAX module always returns promises as well so the interface for all your AJAX stuff should be very similar if you make your own logic return promises. As..

How to chain ajax calls using jquery

http://stackoverflow.com/questions/8612894/how-to-chain-ajax-calls-using-jquery

JSON success function console.log Successful request for self.country self.deferred.resolve DeferredAjax.prototype.promise function return this.deferred.promise var countries US CA MX startingpoint .Deferred startingpoint.resolve .each countries.. request for self.country self.deferred.resolve DeferredAjax.prototype.promise function return this.deferred.promise var countries US CA MX startingpoint .Deferred startingpoint.resolve .each countries function ix country var da new DeferredAjax.. k8aUj 1 Edit A fiddle outputting the log in the result window http jsfiddle.net k8aUj 3 Each pipe call returns a new promise which is in turn used for the next pipe. Note that I only provided the sccess function a similar function should be provided..

jQuery.ajax handling continue responses: “success:” vs “.done”?

http://stackoverflow.com/questions/8840257/jquery-ajax-handling-continue-responses-success-vs-done

done .ajax url ' ' .done function data The nice thing about done is that the return value of .ajax is now a deferred promise that can be bound to anywhere else in your application. So let's say you want to make this ajax call from a few different.. ajax method or you move away from jQuery you only have to change the xhr_get definition being sure to return a promise or at least a done method in the case of the example above . All the other references throughout the app can remain the..

When should I use jQuery deferred's “then” method and when should I use the “pipe” method?

http://stackoverflow.com/questions/9583783/when-should-i-use-jquery-deferreds-then-method-and-when-should-i-use-the-pip

method which replaces it should be used instead. and As of jQuery 1.8 the deferred.then method returns a new promise that can filter the status and values of a deferred through a function replacing the now deprecated deferred.pipe method... be to use .pipe instead function makeCalls here we return the return value of ` .ajax .pipe ` which is a new deferred promise object and connected to the one returned by the callback passed to `pipe` return .ajax ... .pipe function executed after..

Using jQuery with Windows 8 Metro JavaScript App causes security error

http://stackoverflow.com/questions/10859523/using-jquery-with-windows-8-metro-javascript-app-causes-security-error

the function it is passed. I suggest that a better approach is to use the WinJS features this includes the WinJS.Promise object as an alternative to deferred operations which are themselves an implementation of the Promise pattern . And you.. the WinJS.Promise object as an alternative to deferred operations which are themselves an implementation of the Promise pattern . And you can do some basic DOM manipulation using the WinJS.Utilities namespace. You should think twice about using.. using the WinJS.Utilities namespace. You should think twice about using jQuery for deferred operations. The WinJS.Promise object is used throughout the Metro APIs to represent async activities and you will end up using two similar but different..

How do I do a jQuery blocking AJAX call without async = false?

http://stackoverflow.com/questions/11062803/how-do-i-do-a-jquery-blocking-ajax-call-without-async-false

asynchronous share improve this question http bugs.jquery.com ticket 11013#comment 40 The use of the Deferred Promise functionality in synchronous ajax requests has been deprecated in 1.8. The .ajax method with async false is supported but.. deprecated in 1.8. The .ajax method with async false is supported but you must use a callback parameter rather than a Promise method such as .then or .done . So if you are using the success complete error handlers you can still use async false ...

pipe() and then() documentation vs reality in jQuery 1.8

http://stackoverflow.com/questions/12011925/pipe-and-then-documentation-vs-reality-in-jquery-1-8

question is now out of date as the documentation is accurate and up to date. I've been exploring the jQuery Deferred Promise API for a bit and I'm very confused about the differences between pipe and then philosophically and in the jQuery documentation... to be passed along to the promise's .done or .fail callbacks or they can return another observable object Deferred Promise etc which will pass its resolved rejected status and values to the promise's callbacks. If the filter function used is null..

Using JQuery Deferred and Promise

http://stackoverflow.com/questions/13384564/using-jquery-deferred-and-promise

JQuery Deferred and Promise I have a function that I want to use deferred and promise to chain an animation. The first animation is a type writer plugin.. now. Have a look at its documentation It will combine Deferred objects with each other and create immediately resolved Promises for any other values like numbers. Therefore your done callback is also called immidiately and again you make the mistake.. regarding callbacks and chaining and if you want to work with Deferreds you can invoke the promise method to get a Promise for the queue's end. Example call '#ticker' .fadeOut .delay 2000 .typewriter framerate 1000 30 function the typewriter effect..

Wait until all jquery ajax request are done?

http://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-request-are-done

deeper control over the failure modes of the ajax scripts etc. you can save the object returned by .when it's a jQuery Promise object encompassing all of the original ajax queries. You can call .then or .fail on it to add detailed success failure..

jQuery.when - Callback for when ALL Deferreds are no long 'unresolved' (either resolved or rejected)?

http://stackoverflow.com/questions/5824615/jquery-when-callback-for-when-all-deferreds-are-no-long-unresolved-either-r

either resolved or rejected When multiple Deferred objects are passed to jQuery.when the method returns the Promise from a new master Deferred object that tracks the aggregate state of all the Deferreds it has been passed. The method will..

jQuery $.post deferred

http://stackoverflow.com/questions/6433696/jquery-post-deferred

improve this question The jQuery ajax functions return a jqXHR which is itself a deferred object it implements the Promise interface . So no need for .when . There is also no need to use a named function expression for myFunc a normal function..

When should I use jQuery deferred's “then” method and when should I use the “pipe” method?

http://stackoverflow.com/questions/9583783/when-should-i-use-jquery-deferreds-then-method-and-when-should-i-use-the-pip

function or array of functions called when the Deferred is rejected. pipe deferred.pipe doneFilter failFilter Returns Promise doneFilter An optional function that is called when the Deferred is resolved. failFilter An optional function that is called.. same callback parameters though they differ in name and the difference between returning a Deferred and returning a Promise seems slight. I've read the official docs over and over but always find them too dense to really wrap my head around and.. use case that requires then 's returning the original Deferred that can't be done with pipe due to it returning a new Promise jquery asynchronous jquery deferred decoupling jquery chaining share improve this question Since jQuery 1.8 .then behaves..