Wrox Programmer Forums
BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6
This is the forum to discuss the Wrox book Professional Ajax, 2nd Edition by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780470109496
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 11th, 2009, 05:37 PM
Registered User
Join Date: Jun 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default RequestManager object cancel method – Ch 5

The question assumes scenario in which tens of XHR requests have to be managed and occasionally a sent request needs to be canceled.

The RequestManager object provides the cancel method with the request object parameter. One would think that, if sender-client saves sent request object, request could be later canceled by calling the cancel method and supplying saved request object for parameter.
However, sent request object is modified internally by RequestManager, e.g. by adding or changing the age, priority and transport properties. The sender-client is not aware of such modifications and cannot supply a request object the cancel method needs to perform desired cancellation.
My conclusion is that the cancel method in current RequestManager version cannot be called from outside of RequestManager itself.

Is above conclusion correct? If it is, would assigning some unique identifier to every sent request and returning the identifier to sender-client make cancellation possible? This would imply replacing references to request objects with references to request identifiers wherever needed.
Old June 14th, 2009, 01:22 AM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts

You're correct, the RequestManager was written to manage the cancellation for you, not to allow you to cancel the requests manually.

Your proposed approach to extend the functionality would work, and in fact, is the way that many Ajax libraries work.
Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Method reffering to an object beccali JSP Basics 1 March 23rd, 2007 07:24 AM
Object Rexx - Method Not Found ALFisher Other Programming Languages 0 September 7th, 2006 08:55 PM
How to call a method on a remote object eloyitomio C# 1 July 21st, 2006 10:17 AM
Referencing the object that invoked a method benr Classic ASP Professional 0 March 12th, 2006 01:55 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.