Search completed in 0.88 seconds.
Synchronous and asynchronous requests - Web APIs
xmlhttprequest supports both syn
chronous and asyn
chronous communications.
... in general, however, asyn
chronous requests should be preferred to syn
chronous requests for performance reasons.
... syn
chronous requests block the execution of code which causes "freezing" on the screen and an unresponsive user experience.
...And 18 more matches
Introducing asynchronous JavaScript - Learn web development
previous overview: asyn
chronous next in this article we briefly recap the problems associated with syn
chronous javascript, and take a first look at some of the different asyn
chronous techniques you'll encounter, showing how they can help us solve such problems.
... objective: to gain familiarity with what asyn
chronous javascript is, how it differs from syn
chronous javascript, and what use cases it has.
... syn
chronous javascript to allow us to understand what asyn
chronous javascript is, we ought to start off by making sure we understand what syn
chronous javascript is.
...And 20 more matches
General asynchronous programming concepts - Learn web development
overview: asyn
chronous next in this article, we'll run through a number of important concepts relating to asyn
chronous programming, and how this looks in web browsers and javascript.
... objective: to understand the basic concepts behind asyn
chronous programming, and how they manifest in web browsers and javascript.
... asyn
chronous?
...And 12 more matches
Making asynchronous programming easier with async and await - Learn web development
previous overview: asyn
chronous next more recent additions to the javascript language are async functions and the await keyword, part of the so-called ecmascript 2017 javascript edition (see ecmascript next support in mozilla).
... these features basically act as syntactic sugar on top of promises, making asyn
chronous code easier to write and to read afterwards.
... they make async code look more like old-school syn
chronous code, so they're well worth learning.
...And 8 more matches
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
the term asyn
chronous refers to two or more objects or events not existing or happening at the same time (or multiple related things happening without waiting for the previous one to complete).
... in computing, the word "asyn
chronous" is used in two major contexts.
... networking and communications asyn
chronous communication is a method of exchanging messages between two or more parties in which each party receives and processes messages whenever it's convenient or possible to do so, rather than doing so immediately upon receipt.
...And 7 more matches
Asynchronous JavaScript - Learn web development
in this module we take a look at asyn
chronous javascript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server.
... get started prerequisites asyn
chronous javascript is a fairly advanced topic, and you are advised to work through javascript first steps and javascript building blocks modules before attempting this.
... if you are not familiar with the concept of asyn
chronous programming, you should definitely start with the general asyn
chronous programming concepts article in this module.
...And 6 more matches
Graceful asynchronous programming with Promises - Learn web development
previous overview: asyn
chronous next promises are a comparatively new feature of the javascript language that allow you to defer further actions until after a previous action has completed, or respond to its failure.
...if we represented the above pseudo-code using asyn
chronous promises instead, we'd end up with something like this: choosetoppings() .then(function(toppings) { return placeorder(toppings); }) .then(function(order) { return collectorder(order); }) .then(function(pizza) { eatpizza(pizza); }) .catch(failurecallback); this is much better — it is easier to see what is going on, we only need a single .catch() block to handle all the errors, it doesn...
...we're able to chain multiple asyn
chronous actions to occur one after another this way because each .then() block returns a new promise that resolves when the .then() block is done running.
...And 5 more matches
USBIsochronousInTransferPacket - Web APIs
the usbiso
chronousintransferpacket interface of the webusb api is part of the response from a call to the iso
chronoustransferin() method of the usbdevice interface.
... it represents the status of an individual packet from a request to transfer data from the usb device to the usb host over an iso
chronous endpoint.
... constructor usbiso
chronousintransferpacket.usbiso
chronousintransferpacket() creates a new usbiso
chronousintransferpacket object with the provided status and data fields.
...And 4 more matches
USBIsochronousOutTransferPacket - Web APIs
the usbiso
chronousouttransferpacket interface of the webusb api is part of the response from a call to the iso
chronoustransferout() method of the usbdevice interface.
... it represents the status of an individual packet from a request to transfer data from the usb host to the usb device over an iso
chronous endpoint.
... constructor usbiso
chronousouttransferpacket.usbiso
chronousouttransferpacket() creates a new usbiso
chronousouttransferpacket object with the provided status and byteswritten fields.
...And 4 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
previous overview: asyn
chronous next this tutorial looks at the traditional methods javascript has available for running code asy
chronously after a set time period has elapsed, or at a regular interval (e.g.
... objective: to understand asyn
chronous loops and intervals and what they are useful for.
... introduction for a long time, the web platform has offered javascript programmers a number of functions that allow them to asyn
chronously execute code after a certain time interval has elapsed, and to repeatedly execute a block of code asyn
chronously until you tell it to stop.
...And 2 more matches
USBIsochronousInTransferResult - Web APIs
the usbiso
chronousintransferresult interface of the webusb api provides the result from a call to the iso
chronoustransferin() method of the usbdevice interface.
... constructor usbiso
chronousintransferresult.usbiso
chronousintransferresult() creates a new usbiso
chronousintransferresult object with the provided packets and data fields.
... properties usbiso
chronousintransferresult.dataread only returns a dataview object containing the data received from the device.
...And 2 more matches
USBDevice.isochronousTransferOut() - Web APIs
the iso
chronoustransferout() method of the usbdevice interface returns a promise that resolves with a usbiso
chronousouttransferresult when time sensitive information has been transmitted to the usb device.
... syntax var promise = usbdevice.iso
chronoustransferout(endpointnumber, data, packetlengths) parameters endpointnumber the number of a device-specific endpoint (buffer).
... return value a promise that resolves with a usbiso
chronousouttransferresult.
... specifications specification status comment webusbthe definition of 'iso
chronoustransferout()' in that specification.
USBIsochronousOutTransferResult - Web APIs
the usbiso
chronousouttransferresult interface of the webusb api provides the result from a call to the iso
chronoustransferout() method of the usbdevice interface.
... constructor usbiso
chronousouttransferresult.usbiso
chronousouttransferresult() creates a new usbiso
chronousouttransferresult object with the provided packet field.
... properties usbiso
chronousouttransferresult.packetsread only returns an array of usbiso
chronousouttransferpacket objects containing the result of each request to send a packet to the device.
... specifications specification status comment webusbthe definition of 'usbiso
chronousouttransferresult' in that specification.
Synchronous - MDN Web Docs Glossary: Definitions of Web-related terms
syn
chronous refers to real-time communication where each party receives (and if necessary, processes and replies to) messages instantly (or as near to instantly as possible).
... many programming commands are also syn
chronous — for example when you type in a calculation, the environment will return the result to you instantly, unless you program it not to.
... learn more technical reference asyn
chronous syn
chronous and asyn
chronous requests using the xmlhttprequest() api ...
USBDevice.isochronousTransferIn() - Web APIs
the iso
chronoustransferin() method of the usbdevice interface returns a promise that resolves with a usbiso
chronousintransferresult when time sensitive information has been transmitted received from the usb device.
... syntax var promise = usbdevice.iso
chronoustransferin(endpointnumber, packetlengths) parameters endpointnumber the number of a device-specific endpoint (buffer).
... return value a promise that resolves with a usbiso
chronousintransferresult specifications specification status comment webusbthe definition of 'iso
chronoustransferin()' in that specification.
Index - Web APIs
73 animation.pending api, animation, animations, property, reference, web animations, web animations api the read-only animation.pending property of the web animations api indicates whether the animation is currently waiting for an asyn
chronous operation such as initiating playback or pausing a running animation.
... 273 beacon api guide, overview, web performance, user behavior tracker, user tracker the beacon interface is used to schedule an asyn
chronous and non-blocking request to a web server.
... 274 using the beacon api guide, web performance the beacon interface schedules an asyn
chronous and non-blocking request to a web server.
...And 58 more matches
Performance best practices for Firefox front-end engineers
see detecting and avoiding syn
chronous reflow below for more information.
... detecting and avoiding syn
chronous style flushes what are style flushes?
... however, it's possible for script to do things that force multiple style calculations (or style flushes) to occur syn
chronously during the javascript part of the 16 ms window.
...And 19 more matches
Index
204 mozistorageasyncstatement stub an asyn
chronous sql statement.
... 207 mozistoragecompletioncallback this interface should be implemented to handle callbacks from asyn
chronous storage api routines.
... 211 mozistoragependingstatement interfaces, interfaces:scriptable, storage the mozistoragependingstatement interface represents a pending asyn
chronous database statement, and offers the cancel() method which allows you to cancel the pending statement.
...And 14 more matches
Introduction to the File and Directory Entries API - Web APIs
overview the file and directory entries api includes both asyn
chronous and syn
chronous versions of the interfaces.
... the asyn
chronous api can be used in cases where you don't want an outstanding operation to block the ui.
... the syn
chronous api, on the other hand, allows for simpler programming model, but it must be used with webworkers.
...And 14 more matches
Storage
closing a connection to close a connection on which only syn
chronous transactions were performed, use the mozistorageconnection.close() method.
... if you performed any asyn
chronous transactions, you should instead use the mozistorageconnection.asyncclose() method.
... binding one set of parameters if you only have one row to insert, or are using the syn
chronous api you'll need to use this method.
...And 13 more matches
mozIStorageConnection
note: this is not reliable if you are using asyn
chronous statements or if you are using the connection on multiple threads.
... note: this is not reliable if you are using asyn
chronous statements or if you are using the connection on multiple threads.
... note: this is not reliable if you are using asyn
chronous statements or if you are using the connection on multiple threads.
...And 12 more matches
JavaScript Daemons Management - Archive of obsolete content
orceposition = function (vto) { if (isfinite(vto)) { this.index = math.round(math.abs(vto)); } }; daemon.prototype.getduration = function () { return this.rate * this.length; }; daemon.prototype.getdirection = function () { return this.isatend() !== this.backw; }; daemon.prototype.getposition = function () { return this.index; }; /* instantaneous movement (syn
chronous).
... init optional the function which will be syn
chronously invoked once during the creation of the daemon and then assigned to the onstop property.
... onstart optional the function which will be syn
chronously invoked whenever the start event occurs.
...And 11 more matches
IPDL Tutorial
because protocol messages are represented as c++ methods, it's easy to forget that they are in fact asyn
chronous messages: by default the c++ method will return immediately, before the message has been delivered.
... // in a .ipdl file include foo; syn
chronous and rpc messaging up until now, all the messages have been asyn
chronous.
... in ipdl, there are three different semantics: asyn
chronous semantics; the sender is not blocked.
...And 11 more matches
Using Promises - JavaScript
« previousnext » a promise is an object representing the eventual completion or failure of an asyn
chronous operation.
... imagine a function, createaudiofileasync(), which asyn
chronously generates a sound file given a configuration record and two callback functions, one called if the audio file is successfully created, and the other called if an error occurs.
...rn functions return a promise that you can attach your callbacks to instead: if createaudiofileasync() were rewritten to return a promise, using it could be as simple as this: createaudiofileasync(audiosettings).then(successcallback, failurecallback); that's shorthand for: const promise = createaudiofileasync(audiosettings); promise.then(successcallback, failurecallback); we call this an asyn
chronous function call.
...And 11 more matches
Debug - Archive of obsolete content
constants async callback status codes contant description value debug.ms_async_callback_status_assign_delegate the syn
chronous work item assigned a callback or continuation to be run by an asyn
chronous operation.
... 0 debug.ms_async_callback_status_join the syn
chronous work item satisfied part of a join asyn
chronous operation.
... 1 debug.ms_async_callback_status_chooseany the syn
chronous work item satisfied a choice asyn
chronous operation.
...And 10 more matches
AddonManager
the majority of the methods are asyn
chronous meaning that results are delivered through callbacks passed to the method.
... callbacks installcallback() a callback that is passed a single addoninstall void installcallback( in addoninstall install ) parameters install the addoninstall passed back from the asyn
chronous request installlistcallback() a callback that is passed an array of addoninstalls void installlistcallback( in addoninstall installs[] ) parameters installs the array of addoninstalls passed back from the asyn
chronous request addoncallback() a callback that is passed a single addon void addoncallback( in addon addon ) parameters addon the addon passed back from the asynchr...
... addonlistcallback() a callback that is passed an array of addons void addonlistcallback( in addon addons[] ) parameters addons the array of addons passed back from the asyn
chronous request constants addoninstall states constant description state_available an install that is waiting to be started.
...And 10 more matches
Choosing the right approach - Learn web development
previous overview: asyn
chronous to finish this module off, we'll provide a brief discussion of the different coding techniques and features we've discussed throughout, looking at which one you should use when, with recommendations and reminders of common pitfalls where appropriate.
... objective: to be able to make a sound choice of when to use different asyn
chronous programming techniques.
... asyn
chronous callbacks generally found in old-style apis, involves a function being passed into another function as a parameter, which is then invoked when an asyn
chronous operation has been completed, so that the callback can in turn do something with the result.
...And 8 more matches
Optimizing startup performance - Web Performance
instead, we're going to look at a more important issue when building web apps: starting up as asyn
chronously as possible.
... why is it important to be asyn
chronous?
... if you're starting your project from scratch, it's usually pretty easy to just write everything the "right way," making appropriate bits of the code asyn
chronous.
...And 8 more matches
Index - Archive of obsolete content
80 core/promise implementation of promises to make asyn
chronous programming easier.
... 2005 array.observe() array, javascript, method, obsolete the array.observe() method was used for asyn
chronously observing changes to arrays, similar to object.observe() for objects.
... 2024 debug.mstraceasynccallbackcompleted debug, javascript, needscontent, property, reference, mstraceasynccallbackcompleted indicates that the callback stack associated with a previously specified asyn
chronous operation has completed.
...And 7 more matches
Index - Learn web development
49 asyn
chronous javascript beginner, codingscripting, guide, javascript, landing, promises, async, asyn
chronous, await, callbacks, requestanimationframe, setinterval, settimeout in this module we take a look at asyn
chronous javascript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server.
... 50 choosing the right approach beginner, intervals, javascript, learn, optimize, promises, async, asyn
chronous, await, requestanimationframe, setinterval, settimeout, timeouts to finish this module off, we'll provide a brief discussion of the different coding techniques and features we've discussed throughout, looking at which one you should use when, with recommendations and reminders of common pitfalls where appropriate.
... 51 cooperative asyn
chronous javascript: timeouts and intervals animation, beginner, codingscripting, guide, intervals, javascript, loops, asyn
chronous, requestanimationframe, setinterval, settimeout, timeouts this tutorial looks at the traditional methods javascript has available for running code asy
chronously after a set time period has elapsed, or at a regular interval (e.g.
...And 7 more matches
IME handling guide
finally, this class guarantees that requesting to commit or cancel current composition to ime is perefored syn
chronously.
... notify_ime_of_blur when an imecontentobserver instance ends observing the focused editor, this is sent to widget syn
chronously because assumed that this notification causes neither query content events nor composition events.
...even if commit or canceling composition does not occur syn
chronously, widget doesn't need to emulate it since textcomposition will emulate it automatically.
...And 7 more matches
Promise - JavaScript
the promise object represents the eventual completion (or failure) of an asyn
chronous operation, and its resulting value.
...it allows you to associate handlers with an asyn
chronous action's eventual success value or failure reason.
... this lets asyn
chronous methods return values like syn
chronous methods: instead of immediately returning the final value, the asyn
chronous method returns a promise to supply the value at some point in the future.
...And 7 more matches
RDF in Mozilla FAQ - Archive of obsolete content
if the uri argument refers to an rdf/xml file's url, then the rdf service will create an rdf/xml datasource and asyn
chronously parse it.
...var ds = rdf.getdatasource("http://www.mozilla.org/some-rdf-file.rdf"); // note that ds will load asyn
chronously, so assertions will not // be immediately available alternatively, you can create one directly using the xpcom component manager, as the following code fragment illustrates: // create an rdf/xml datasource using the xpcom component manager var ds = components .classes["@mozilla.org/rdf/datasource;1?name=xml-datasource"] .createinstance(components.interfaces.nsirdfdatasource); // the ...
...note that this will happen asyn
chronously.
...And 6 more matches
Scroll-linked effects
these effects work well in browsers where the scrolling is done syn
chronously on the browser's main thread.
... however, most browsers now support some sort of asyn
chronous scrolling in order to provide a consistent 60 frames per second experience to the user.
... in the asyn
chronous scrolling model, the visual scroll position is updated in the compositor thread and is visible to the user before the scroll event is updated in the dom and fired on the main thread.
...And 6 more matches
DevTools API - Firefox Developer Tools
{toolid}-build(panel) the frame for a tool has loaded and the toolpanel.build() method has been called but the asyn
chronous initialization has not started.
... {toolid}-ready(panel) the asyn
chronous initialization for a tool has completed and it is ready to be used.
...a method that can be used to perform asyn
chronous initialization.
...And 6 more matches
File and Directory Entries API - Web APIs
two very similar apis exist depending on whether you desire asyn
chronous or syn
chronous behavior.
... the syn
chronous api is intended to be used inside a worker and will return the values you desire.
... the asyn
chronous api will not block and functions and the api will not return values; instead, you will need to supply a callback function to handle the response whenever it arrives.
...And 6 more matches
test/utils - Archive of obsolete content
ter } = require('sdk/test/utils'); let { search } = require('sdk/places/bookmarks'); exports.testcountbookmarks = function (assert, done) { search().on('end', function (results) { assert.equal(results, 0, 'should be no bookmarks'); done(); }); }; before(exports, function (name, assert) { removeallbookmarks(); }); require('sdk/test').run(exports); both before and after may be asyn
chronous.
... to make them asyn
chronous, pass a third argument done, which is a function to call when you have finished: let { before, after } = require('sdk/test/utils'); let { search } = require('sdk/places/bookmarks'); exports.testcountbookmarks = function (assert, done) { search().on('end', function (results) { assert.equal(results, 0, 'should be no bookmarks'); done(); }); }; before(exports, function (name, assert, done) { removeallbookmarksasync(function () { done(); }); }); require('sdk/test').run(exports); globals functions before(exports, beforefn) runs beforefn before each test in the file.
... may be asyn
chronous if beforefn accepts a third argument, which is a callback.
...And 5 more matches
Promises - Archive of obsolete content
promise apis for common asyn
chronous operations due to the performance and stability costs of syn
chronous io, many apis which rely on it have been deprecated.
...these apis allow asyn
chronous operation to be achieved with a coding style similar to syn
chronous variants.
... the following examples make use of the task api, which harnesses generator functions to remove some of the syntactic clutter of raw promises, such that asyn
chronous promise code more closely resembles syn
chronous, procedural code.
...And 5 more matches
Cross Process Object Wrappers
this document describes cross process object wrappers (cpows), which enable chrome code to syn
chronously access content in multiprocess firefox.
... chrome to content messaging must be asyn
chronous.
... converting syn
chronous code to be asyn
chronous can be difficult and time-consuming.
...And 5 more matches
AsyncTestUtils extended framework
two following lines, add them at the top of your test file (before the lines shown above): load("../../mailnews/resources/maildirservice.js"); load("../../mailnews/resources/mailtestutils.js"); at the bottom of the test file, add the following: var tests =[ // list your tests here ]; function run_test() { configure_message_injection({mode: "local"}); async_run_tests(tests); } asyn
chronous testing basics why do we need it?
... sometimes in your tests you need to wait for an operation to complete that does not occur syn
chronously (that is, it is not done when the function call you made to initiate the operation returns control to you).
...this is how asyn
chronous callbacks get their chance to run again.
...And 5 more matches
async function - JavaScript
the async and await keywords enable asyn
chronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.
...await expressions suspend progress through an async function, yielding control and subsequently resuming progress only when an awaited promise-based asyn
chronous operation is either fulfilled or rejected.
...use of async / await enables the use of ordinary try / catch blocks around asyn
chronous code.
...And 5 more matches
Console messages - Firefox Developer Tools
async stack frames stack traces show stack frames for async functions separately from those for syn
chronous functions.
...by logging reflow events the web console can give you insight into when reflow events are being triggered, how long they take to execute and, if the reflows are syn
chronous reflows triggered from javascript, which code triggered them.
... if the reflow is a syn
chronous reflow triggered from javascript, it also shows a link to the line of code that triggered the reflow.
...And 4 more matches
Navigator.sendBeacon() - Web APIs
the navigator.sendbeacon() method asyn
chronously sends a small amount of data over http to a web server.
... ensuring that data has been sent during the unloading of a document has traditionally been difficult, because user agents typically ignore asyn
chronous xmlhttprequests made in an unload handler.
... historically, this was addressed with some of the following workarounds to delay the page unload long enough to send data to some url: submitting the data with a blocking syn
chronous xmlhttprequest call in unload or beforeunload event handlers.
...And 4 more matches
Using Service Workers - Web APIs
let’s compare a traditional syn
chronous callback structure to its asyn
chronous promise equivalent.
...when the promise resolves, the code inside then will be run, asyn
chronously.
...and, ummm, it’s still syn
chronous, so blocks the main thread.
...And 4 more matches
Promise.all() - JavaScript
an asyn
chronously resolved promise if the iterable passed contains no promises.
...this returned promise is then resolved/rejected asyn
chronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject.
...it is typically used when there are multiple asyn
chronous tasks that are dependent on one another to complete successfully, as it does not wait and will reject immediately upon any of the input promises rejecting.
...And 4 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
one concrete example is window.open, which opens a new window: <script> function doopenwindow(){ var mywindow = window.open("about:blank"); mywindow.location.href = "http://www.ibm.com"; } </script> the problem with the code is that window.open is asyn
chronous -- it does not block the javascript execution until the window has finished loading.
... after instantiating the object using new xmlhttprequest(), you can use the open method to specify what type of request (get or post) you use, which file you load, and if it is asyn
chronous or not.
... if the call is asyn
chronous, then give the onload member a function reference, which is called once the request has completed.
...And 3 more matches
Communicating with frame scripts
the api is mostly symmetrical, with one major exception: frame scripts can send asyn
chronous or syn
chronous messages to chrome, but chrome can only send asyn
chronous messages to content.
... where absolutely necessary, frame scripts can pass wrappers called cross process object wrappers (also known as cpows) to chrome, and chrome can use these wrappers to get syn
chronous access to content objects.
... content to chrome the frame script can choose to send syn
chronous or asyn
chronous messages to chrome code.
...And 3 more matches
Necko Architecture
receiving data & nsistreamlistener you can read or write, from or to a channel using either the syn
chronous api, or the asyn
chronous api.
... if you want to move data asyn
chronously you need to be able to receive callbacks using an implementation of nsistreamlistener.
...if you initiate a syn
chronous transfer on a channel, you are handed back a stream that you can read or write from or to.
...And 3 more matches
nsIContentPrefService2
dom/interfaces/base/nsicontentprefservice2.idlscriptable asyn
chronous api for content preferences 1.0 66 introduced gecko 20.0 inherits from: nsisupports last changed in gecko 20.0 (firefox 20.0 / thunderbird 20.0 / seamonkey 2.17) description content preferences allow the application to associate arbitrary data, or "preferences", with specific domains, or web "content".
...callbacks the methods of callback objects are always called asyn
chronously.
... getcachedbydomainandname() syn
chronously retrieves from the in-memory cache the preference with the given domain and name.
...And 3 more matches
IndexedDB API - Web APIs
learn to use indexeddb asyn
chronously from first principles with our using indexeddb guide.
... syn
chronous and asyn
chronous operations performed using indexeddb are done asyn
chronously, so as not to block applications.
... indexeddb originally included both syn
chronous and asyn
chronous apis.
...And 3 more matches
Using XMLHttpRequest - Web APIs
function reqlistener () { console.log(this.responsetext); } var oreq = new xmlhttprequest(); oreq.addeventlistener("load", reqlistener); oreq.open("get", "http://www.example.org/example.txt"); oreq.send(); types of requests a request made via xmlhttprequest can fetch the data in one of two ways, asyn
chronously or syn
chronously.
...if this argument is true or not specified, the xmlhttprequest is processed asyn
chronously, otherwise the process is handled syn
chronously.
... a detailed discussion and demonstrations of these two types of requests can be found on the syn
chronous and asyn
chronous requests page.
...And 3 more matches
Promise.any() - JavaScript
an asyn
chronously resolved promise if the iterable passed contains no promises.
...this returned promise is then resolved/rejected asyn
chronously (as soon as the stack is empty) when any of the promises in the given iterable resolve, or if all the promises have rejected.
... fulfilment if any of the passed-in promises fulfil, the returned promise asyn
chronously fulfils with the value of the promise that fulfilled, whether or not the other promises have fulfilled or rejected.
...And 3 more matches
Promise.prototype.then() - JavaScript
return value once a promise is fulfilled or rejected, the respective handler function (onfulfilled or onrejected) will be called asyn
chronously (scheduled in the current thread loop).
... // using a resolved promise, the 'then' block will be triggered instantly, // but its handlers will be triggered asyn
chronously as demonstrated by the console.logs const resolvedprom = promise.resolve(33); let thenprom = resolvedprom.then(value => { console.log("this gets called after the end of the main stack.
...the below snippet simulates asyn
chronous code with the settimeout function.
...And 3 more matches
Appendix D: Loading Scripts - Archive of obsolete content
these tags are generally inserted into xul overlay files or other xul documents, after which they are automatically loaded into the context of the xul window in question and executed immediately and syn
chronously.
... in addition to compile time, reading files syn
chronously from disk has its own overhead, and xmlhttprequests have significantly more overhead than native loading methods.
... advantages asyn
chronous: workers execute asyn
chronously in their own threads, which means that they have limited risk of interfering with the main thread.
...And 2 more matches
Connecting to Remote Content - Archive of obsolete content
.createinstance(components.interfaces.nsixmlhttprequest); request.onload = function(aevent) { window.alert("response text: " + aevent.target.responsetext); }; request.onerror = function(aevent) { window.alert("error status: " + aevent.target.status); }; request.open("get", url, true); request.send(null); in this example we demonstrate how to make a xmlhttprequest call in asyn
chronous mode.
... request.open("post", url, true); request.setrequestheader("content-type", "application/x-www-form-urlencoded"); request.send("data=hello&version=2"); the third parameter for the open method specifies whether the request should be handled asyn
chronously or not.
... in asyn
chronous mode code execution continues immediately after the send call.
...And 2 more matches
Debug.msTraceAsyncCallbackCompleted - Archive of obsolete content
the debug.mstraceasynccallbackcompleted function indicates that an asyn
chronous operation has completed.
... syntax debug.mstraceasynccallbackcompleted() parameters asyncoperationid the id associated with the asyn
chronous operation.
... status optional the status of the asyn
chronous operation.
...And 2 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
14 ajax ajax, codingscripting, glossary, infrastructure, l10n:priority ajax, which initially stood for asyn
chronous javascript and xml, is a programming practice of building complex, dynamic webpages using a technology known as xmlhttprequest.
... 24 asyn
chronous glossary, web, webmechanics, asyn
chronous the term asyn
chronous refers to or multiple related things happening without waiting for the previous one to complete).
... 335 promise glossary, promise, promises, asyn
chronous a promise is an object that's returned by a function that has not yet completed its work.
...And 2 more matches
L20n Javascript API
you can listen to the ready event (emitted by the context instance when all the resources have been compiled) and use ctx.getsync and ctx.getentitysync to get translations syn
chronously.
...deflocale) { return intl.prioritizelocales(available, requested, deflocale); }); negotiator is a function which takes the following arguments: available - all locales available to the context instance, requested - locales preferred by the user, deflocale - the default locale to be used as the ultimate fallback, callback - the function to call when the negotiation completes (useful for asyn
chronous negotiators).
... it must return an array which is the final fallback chain of locales, or if the negotiation is asyn
chronous, it must return a falsy value and call the callback argument upon completion.
...And 2 more matches
nsIStreamConverter
stream converter users there are currently two ways to use a stream converter: syn
chronous: stream to stream.
... asyn
chronous: nsistreamlistener to nsistreamlistener.
...t key is defined in this file): @mozilla.org/streamconv;1?from=from_mime_type&to=to_mime_type method overview void asyncconvertdata(in string afromtype, in string atotype, in nsistreamlistener alistener, in nsisupports actxt); nsiinputstream convert(in nsiinputstream afromstream, in string afromtype, in string atotype, in nsisupports actxt); methods asyncconvertdata() asyn
chronous version: converts data arriving via the converter's nsistreamlistener.ondataavailable() method from one type to another, pushing the converted data out to the caller via alistener::ondataavailable().
...And 2 more matches
Using IndexedDB - Web APIs
about this document this tutorial walks you through using the asyn
chronous api of indexeddb.
...this article documents the types of objects used by indexeddb, as well as the methods of the asyn
chronous api (the syn
chronous api was removed from spec).
...most other asyn
chronous functions in indexeddb do the same thing - return an idbrequest object with the result or error.
...And 2 more matches
PaymentRequest.show() - Web APIs
processing the result and, if necessary, calling paymentresponse.retry() to retry a failed payment can all be done either asyn
chronously or syn
chronously, depending on your needs.
... for the best user experience, asyn
chronous solutions are typically the best way to go.
... most examples on mdn and elsewhere use async/await to wait asyn
chronously while results are validated and so forth.
...And 2 more matches
HTML in XMLHttpRequest - Web APIs
limitations to discourage the syn
chronous use of xmlhttprequest, html support is not available in the syn
chronous mode.
... usage retrieving an html resource as a dom using xmlhttprequest works just like retrieving an xml resource as a dom using xmlhttprequest, except you can't use the syn
chronous mode and you have to explicitly request a document by assigning the string "document" to the responsetype property of the xmlhttprequest object after calling open() but before calling send().
... function htmlinxhr() { if (!window.xmlhttprequest) return false; var req = new window.xmlhttprequest(); req.open('get', window.location.href, false); try { req.responsetype = 'document'; } catch(e) { return true; } return false; } view on jsfiddle this method is syn
chronous, does not rely on external assets though it may not be as reliable as method 2 described below since it does not check the actual feature but an indication of that feature.
...And 2 more matches
XMLHttpRequest.responseType - Web APIs
exceptions invalidaccesserror an attempt was made to change the value of responsetype on anxmlhttprequest which is in syn
chronous mode but not in a worker.
... for additional details, see syn
chronous xhr restrictions below.
... usage notes syn
chronous xhr restrictions you cannot change the value of responsetype in a syn
chronous xmlhttprequest except when the request belongs to a worker.
...And 2 more matches
Getting Started - Developer guides
ajax stands for asyn
chronous javascript and xml.
...ajax’s most appealing characteristic is its "asyn
chronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page.
... the optional third parameter sets whether the request is asyn
chronous.
...And 2 more matches
Promise() constructor - JavaScript
the signature of this function is expected to be: function(resolutionfunc, rejectionfunc){ // typically, some asyn
chronous operation.
...the side-effect is that the promiseobj becomes "resolved." typically, it works like this: the operation within executor is asyn
chronous and provides a callback.
... the promiseobj (asyn
chronously) invokes any .then() associated with it.
...And 2 more matches
core/promise - Archive of obsolete content
implementation of promises to make asyn
chronous programming easier.
... rationale most of the js apis are asyn
chronous complementing its non-blocking nature.
... // read content of url asyn
chronously then(parse).
...as a matter of fact it would be great if we could convert any syn
chronous functions to asyn
chronous by making it aware of promises.
Binding Attachment and Detachment - Archive of obsolete content
var checkbox = document.getelementbyid("mycheckbox"); checkbox.style.mozbinding = "url(http://www.mozilla.org/xbl/htmlbindings.xml#checkbox)"; this attachment is not necessarily syn
chronous.
...therefore if all the bindings in a chain come from binding documents that have already been loaded by the bound document, then the attachment of a binding (either through css or through the dom) is guaranteed to be syn
chronous.
... an author can ensure that all bindings are syn
chronously attached by calling loadbindingdocument to pre-fetch any xbl documents that are required.
... if the binding document is loaded prior to the firing of the load event, then any binding attachments that are placed following the load will be syn
chronous if they come from one of these previously loaded binding documents.
Debug.msTraceAsyncCallbackStarting - Archive of obsolete content
the debug.mstraceasynccallbackstarting function associates the callback stack with a previously specified asyn
chronous operation.
... syntax debug.mstraceasynccallbackstarting(asyncoperationid) parameters asyncoperationid the id associated with the asyn
chronous operation.
... remarks call this function in the callback function for the asyn
chronous operation after the call to debug.mstraceasyncoperationcompleted.
... example the following code provides an example of tracing an asyn
chronous call for a windows 8.x store app.
Debug.msUpdateAsyncCallbackRelation - Archive of obsolete content
the debug.msupdateasynccallbackrelation function updates the relationship status between a syn
chronous work item and the associated asyn
chronous operation.
... syntax debug.msupdateasynccallbackrelation(relatedasyncoperationid, relationtype) parameters relatedasyncoperationid the id associated with the asyn
chronous operation.
... remarks the syn
chronous work item is typically the callback function for the asyn
chronous operation.
... this function may be called when an asyn
chronous operation is aborted, when a join operation is used, or in other scenarios.
Fetching data from the server - Learn web development
note: in the early days, this general technique was known as asyn
chronous javascript and xml (ajax), because it tended to use xmlhttprequest to request xml data.
...add this next: request.responsetype = 'text'; fetching a resource from the network is an asyn
chronous operation, meaning that you have to wait for that operation to complete (e.g., the resource is returned from the network) before you can do anything with that response, otherwise, an error will be thrown.
... fetch the fetch api is basically a modern replacement for xhr; it was introduced in browsers recently to make asyn
chronous http requests easier to do in javascript, both for developers and other apis that build on top of fetch.
... after that, you can see the .then() method chained onto the end of fetch() — this method is a part of promises, a modern javascript feature for performing asyn
chronous operations.
Application cache implementation overview
it syn
chronously returns an nsiapplicationcache object representing the most recent cache version from the most recent cache group containing the entry under the url or a matching namespace.
...updating an existing cache or first download of an offline cache the process of updating or first caching is invoked asyn
chronously from nscontentsink::processofflinemanifest() using nsofflinecacheupdateservice.
... the parallel load is implemented by asyn
chronous recursive calls to processnexturi(), a method searching always a single entry that is scheduled to load.
...processnexturi then invokes it self asyn
chronously via dispatch to a main thread when not already on the concurrency limit of 15 loads.
HTML parser threading
if the parser isn't blocked, document.write() parses input into tree ops syn
chronously and flushes the tree ops syn
chronously by calling nshtml5treeopexecutor::flushdocumentwrite().
...inline scripts that arrive from document.write() are executed syn
chronously (if the parser isn't already blocked).
...(how exactly data is inserted into the buffer list depends on parser keys when document.write() is invoked re-entrantly, but that's outside the scope of this document, since this document is about parser threading.) whenever the argument of document.write() isn't tokenized to completion syn
chronously, the part left unprocessed by the main document.write() tokenizer/tree builder is processed by the third tokenizer/tree builder pair.
...on the main thread, the speculative tokenizer/tree builder pair used for parsing document.write() input that didn't get parsed by the main document.write() tokenizer/tree builder syn
chronously also sends speculative loads to the tree op executor.
How to implement a custom autocomplete search component
ults[index]; }, queryinterface: xpcomutils.generateqi([ ci.nsiautocompleteresult ]) }; /** * @constructor * * @implements {nsiautocompletesearch} */ function providerautocompletesearch() { } providerautocompletesearch.prototype = { classid: class_id, classdescription : class_name, contractid : contract_id, /** * searches for a given string and notifies a listener (either syn
chronously * or asyn
chronously) of the result * * @param searchstring the string to search for * @param searchparam an extra parameter * @param previousresult a previous result to use for faster searchinig * @param listener the listener to notify when the search is complete */ startsearch: function(searchstring, searchparam, previousresult, listener) { var results = ['mary', '...
...john']; var autocomplete_result = new providerautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", results, null); listener.onsearchresult(this, autocomplete_result); }, /** * stops an asyn
chronous search that is in progress */ stopsearch: function() { }, queryinterface: xpcomutils.generateqi([ ci.nsiautocompletesearch ]) }; // the following line is what xpcom uses to create components const nsgetfactory = xpcomutils.generatensgetfactory([ providerautocompletesearch ]); then register your xpcom component.
...(index, 1); }, queryinterface: function(aiid) { if (!aiid.equals(ci.nsiautocompleteresult) && !aiid.equals(ci.nsisupports)) throw components.results.ns_error_no_interface; return this; } }; // implements nsiautocompletesearch function simpleautocompletesearch() { } simpleautocompletesearch.prototype = { /* * search for a given string and notify a listener (either syn
chronously * or asyn
chronously) of the result * * @param searchstring - the string to search for * @param searchparam - an extra parameter * @param previousresult - a previous result to use for faster searchinig * @param listener - a listener to notify when the search is complete */ startsearch: function(searchstring, searchparam, result, listener) { // this autocomplete sourc...
...(searchresults[i].value); if (searchresults[i].comment) comments.push(searchresults[i].comment); else comments.push(null); } } var newresult = new simpleautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", results, comments); listener.onsearchresult(this, newresult); } }, /* * stop an asyn
chronous search that is in progress */ stopsearch: function() { }, queryinterface: function(aiid) { if (!aiid.equals(ci.nsiautocompletesearch) && !aiid.equals(ci.nsisupports)) throw components.results.ns_error_no_interface; return this; } }; // factory var simpleautocompletesearchfactory = { singleton: null, createinstance: function (aouter, aiid) { if (aouter != nul...
Optimizing Applications For NSPR
nspr does take advantage of macintosh' asyn
chronous i/o capability to perform scheduling during i/o.
...nspr's file i/o is done using windows 3.1's syn
chronous file i/o api.
... the nspr file i/o apis may cause a thread switch even though the i/o is fully syn
chronous.
... do not depend on file i/o being syn
chronous.
SavedFrame
asynccause if this stack frame is the asyncparent of other stack frames, then this is a string representing the type of asyn
chronous call by which this frame invoked its children.
...if the asyn
chronous call was started in a descendant frame to which the requester of the property does not have access, this will be the generic string "async".
... if this is not an asyn
chronous call point, this will be null.
... asyncparent if this stack frame was called as a result of an asyn
chronous operation, for example if the function referenced by this frame is a promise handler, this property points to the stack frame responsible for the asyn
chronous call, for example where the promise was created.
Making cross-thread calls using runnables
in general, threading and message passing should be asyn
chronous.
... for example, let's say we have a function, calculatepi(int digits), which will calculate π to an arbitrary number of digits: void calculatepi(int digits, nscstring& result); // this is syn
chronous this can take a while, so we don't want to run this on the main thread.
...so we declare an asyn
chronous version of the same function: typedef void (*picallback)(const nscstring& result); // callback function void calculatepiasyn
chronously(int digits, picallback callback); creating a runnable nsrunnable is a helper class: it already implements threadsafe refcounting, so all you need to do is override the run() function.
...{ } ns_imethod run() { nscstring result; calculatepi(mdigits, result); nscomptr<nsirunnable> resultrunnable = new piresulttask(mcallback, result); ns_dispatchtomainthread(resultrunnable); } private: picallback mcallback; int mdigits; }; putting it all together to start a new thread, create it using the thread manager: #include "nsxpcomcidinternal.h" void calculatepiasyn
chronously(int digits, picallback callback) { // to create a new thread, get the thread manager nscomptr<nsithreadmanager> tm = do_getservice(ns_threadmanager_contractid); nscomptr<nsithread> mythread; nsresult rv = tm->newthread(0, 0, getter_addrefs(mythread)); if (ns_failed(rv)) { // in case of failure, call back immediately with an empty string which indicates failure callback(empty...
XPCOM Stream Guide
there are two ways of getting the input stream: by calling the channel's .open() method for a syn
chronous read, or by calling the channel's .asyncopen() method with an nsistreamlistener object.
... this is also a syn
chronous (blocking) operation, so if you're in javascript, consider using netutil.jsm as described below.
...most streams are asyn
chronous: they make no assumptions that all the data a resource provides is available immediately.
... there are two parts: initializing the pump, and telling it to asyn
chronously read data into the stream listener: var pump = components.classes["@mozilla.org/network/input-stream-pump;1"] .createinstance(components.interfaces.nsiinputstreampump); pump.init(stream, -1, -1, 0, 0, true); pump.asyncread(listener, context); nsipipe code examples file input and output for file input, see code snippets: reading from a file.
mozIStorageAsyncStatement
an asyn
chronous sql statement.
... this differs from mozistoragestatement by only being usable for asyn
chronous execution.
... (mozistoragestatement can be used for both syn
chronous and asyn
chronous purposes.) this specialization for asyn
chronous operation allows us to avoid needing to acquire synchronization primitives also used by the asyn
chronous execution thread.
... in contrast, mozistoragestatement may need to acquire the primitives and consequently can cause the main thread to lock for extended intervals while the asyn
chronous thread performs some long-running operation.
nsICacheSession
netwerk/cache/public/nsicachesession.idlscriptable handles open syn
chronous and asyn
chronous cache entry operations along with evicting cache entries and checking for cache devices instantiation according to the session storage policies.
... methods asyncopencacheentry() this method gives an asyn
chronous cache access.
... doomentry() asyn
chronously dooms an entry specified by the key.
...opencacheentry() this method gives a syn
chronous cache access.
nsITextInputProcessorNotification
when this is requested, the callback should commit composition syn
chronously, i.e., nsitextinputprocessor.commitcomposition() should be called.
... if the callback doesn't want to commit the composition syn
chronously, it's okay to commit it later (i.e., asyn
chronously).
... when this is requested, the callback should cancel composition syn
chronously, i.e., nsitextinputprocessor.cancelcomposition() should be called.
... if the callback doesn't want to cancel the composition syn
chronously, it's okay to cancel it later (i.e., asyn
chronously).
URLs - Plugins
note that npn_geturl is typically asyn
chronous: it returns immediately and only later handles the request, such as displaying the url or creating the stream for the instance and writing the data.
... npn_geturlnotify handles the url request asyn
chronously.
... npn_posturl is typically asyn
chronous: it returns immediately and only later handles the request and calls npp_notify (which, in turn, calls npp_urlnotify).
...npn_posturlnotify is typically asyn
chronous: it returns immediately and only later handles the request and calls npp_urlnotify.
Beacon API - Web APIs
the beacon interface is used to schedule an asyn
chronous and non-blocking request to a web server.
... user agents will typically ignore asyn
chronous xmlhttprequests made in an unload handler.
... to solve this problem, analytics and diagnostics code will typically make a syn
chronous xmlhttprequest in an unload or beforeunload handler to submit the data.
... the syn
chronous xmlhttprequest forces the browser to delay unloading the document, and makes the next navigation appear to be slower.
IDBRequest - Web APIs
the idbrequest interface of the indexeddb api provides access to results of asyn
chronous requests to databases and database objects using event handler attributes.
... all asyn
chronous operations immediately return an idbrequest instance.
... in plain words, all asyn
chronous methods return a request object.
... example in the following code snippet, we open a database asyn
chronously and make a request; onerror and onsuccess functions are included to handle the success and error cases.
Basic concepts - Web APIs
indexeddb is an asyn
chronous api that can be used in most contexts, including web workers.
... it used to include a syn
chronous version also, for use in web workers, but this was removed from the spec due to lack of interest by the web community.
... the indexeddb api is mostly asyn
chronous.
...you don't "store" a value into the database, or "retrieve" a value out of the database through syn
chronous means.
Migrating from webkitAudioContext - Web APIs
var osc = context.createoscillator(); osc.noteon(1); osc.noteoff(1.5); var src = context.createbuffersource(); src.notegrainon(1, 0.25); src.noteoff(2); you can simply change it like this in order to port it to the standard audiocontext api: var osc = context.createoscillator(); osc.start(1); osc.stop(1.5); var src = context.createbuffersource(); src.start(1, 0.25); src.stop(2); remove syn
chronous buffer creation in the old webkit implementation of web audio, there were two versions of createbuffer(), one which created an initially empty buffer, and one which took an existing arraybuffer containing encoded audio, decoded it and returned the result in the form of an audiobuffer.
... the latter version of createbuffer() was potentially expensive, because it had to decode the audio buffer syn
chronously, and with the buffer being arbitrarily large, it could take a lot of time for this method to complete its work, and no other part of your web page's code could execute in the mean time.
... because of these problems, this version of the createbuffer() method has been removed, and you should use the asyn
chronous decodeaudiodata() method instead.
...; xhr.open("get", "/path/to/audio.ogg", true); xhr.responsetype = "arraybuffer"; xhr.send(); xhr.onload = function() { context.decodeaudiodata(xhr.response, function onsuccess(decodedbuffer) { // decoding was successful, do something useful with the audio buffer }, function onfailure() { alert("decoding the audio buffer failed"); }); }; note that the decodeaudiodata() method is asyn
chronous, which means that it will return immediately, and then when the decoding finishes, one of the success or failure callback functions will get called depending on whether the audio decoding was successful.
Web Locks API - Web APIs
the web locks api allows scripts running in one tab or worker to asyn
chronously acquire a lock, hold it while work is performed, then release it.
... work is done while holding the lock in an asyn
chronous task.
... the api provides optional functionality that may be used as needed, including: returning values from the asyn
chronous task shared and exclusive lock modes conditional acquisition diagnostics to query the state of locks in an origin an escape hatch to protect against deadlocks locks are scoped to origins; the locks acquired by a tab from https://example.com have no effect on the locks acquired by a tab from https://example.org:8080 as they are separate origins.
... the request() method itself returns a promise which resolves once the lock has been released; within an async function, a script can await the call to make the asyn
chronous code flow linear.
WebAssembly.Module() constructor - JavaScript
the webassembly.module() constructor function can be called to syn
chronously compile given webassembly binary code.
... however, the primary way to get a module is through an asyn
chronous compilation function like webassembly.compile().
... syntax important: since compilation for large modules can be expensive, developers should only use the module() constructor when syn
chronous compilation is absolutely required; the asyn
chronous webassembly.compilestreaming() method should be used at all other times.
... examples syn
chronously compiling a webassembly module var importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; function createwasmmodule(bytes) { return new webassembly.module(bytes); } fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => { let mod = createwasmmodule(bytes); webassembly.instantiate(mod, importobject) .then(result => result.exports.exported_func() ); }) specifications specification webassembly javascript interfacethe definition of 'webassembly.module()' in that specification.
Web Performance
it is important to minimize the loading and response times and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asyn
chronously loading in the longer tail parts of the experience.
...instead, we're going to look at a more important issue when building web apps: starting up as asyn
chronously as possible.
... beacon api the beacon interface schedules an asyn
chronous and non-blocking request to a web server.
... intersection observer api learn to time element visibility with the intersection observer api and be asyn
chronously notified when elements of interest becomes visible.
File I/O - Archive of obsolete content
// you can read it into a string with var data = netutil.readinputstreamtostring(inputstream, inputstream.available()); }); read with content type hint it's useful to provide a content type hint to prevent the file system from doing a potentially expensive content type look up (which would be syn
chronous i/o).
... function streamtofile(stream, file, callback) { var output = fileutils.opensafefileoutputstream(file) netutil.asynccopy(stream, output, callback); } syn
chronous checking the existence of a file // |file| is nsifile if (file.exists()) { // ...
... } note: you should avoid checking the existence of a file, not only because of the syn
chronous i/o on the main thread this causes.
Jetpack Processes - Archive of obsolete content
privileged apis when script is evaluated in a jetpack process via a call to nsijetpack.evalscript(), the script's global scope is endowed with the following privileged apis: sendmessage(amessagename [, v1 [, v2 [, ...]]]) similar to nsijetpack.sendmessage(), this function asyn
chronously sends a message to the chrome process.
... callmessage(amessagename [, v1 [, v2 [, ...]]]) this function is like sendmessage() but sends the message syn
chronously.
...gc() syn
chronously performs garbage collection.
Notes on HTML Reflow - Archive of obsolete content
other reflows are incremental and are dealt with asyn
chronously; for example, when content streams in from the network.
... incremental reflows are dispatched en masse when the presentation shell's incremental reflow queue is asyn
chronously serviced.
...instead, it queues the command, and processes it asyn
chronously along with other queued reflow commands en masse .
Using IO Timeout And Interrupt On NT - Archive of obsolete content
nspr io on nt the io model of nspr 2.0 is syn
chronous and blocking.
...on windows nt, nspr io is implemented using nt's overlapped (also called asyn
chronous) io.
...the win95 version runs without trouble on nt, but you would lose the better performance provided by nt fibers and asyn
chronous io.
Sending forms through JavaScript - Learn web development
when the user tries to send the data, the application takes control and transmits the data asyn
chronously in the background, updating only the parts of the ui that require changes.
... sending arbitrary data asyn
chronously is generally called ajax, which stands for "asyn
chronous javascript and xml".
...window.addeventlistener( 'load', function () { // these variables are used to store the form data const text = document.getelementbyid( "thetext" ); const file = { dom : document.getelementbyid( "thefile" ), binary : null }; // use the filereader api to access file content const reader = new filereader(); // because filereader is asyn
chronous, store its // result when it finishes to read the file reader.addeventlistener( "load", function () { file.binary = reader.result; } ); // at page load, if a file is already selected, read it.
Error codes returned by Mozilla APIs
ns_binding_failed (0x804b0001) ns_binding_aborted (0x804b0002) the asyn
chronous request failed because it was aborted by some user action.
... ns_binding_redirected (0x804b0003) the asyn
chronous request has been "redirected" to a different async request.
... ns_binding_retargeted (0x804b0004) the asyn
chronous request has been "retargeted" to a different "handler." this error code is used with load groups to notify the load group observer when a request in the load group is removed from the load group and added to a different load group.
Limitations of chrome scripts
for example: whenever extensions try to access web content from the chrome process, the browser will return a cross process object wrapper that gives the chrome code syn
chronous access to the content.
... limitations of cpows cross process object wrappers (cpows) are a migration aid giving chrome code syn
chronous access to content objects.
...however, the domwindow is passed asyn
chronously, so by the time the chrome process receives it, the dom might have changed (for example, because code running in the content process modified it or we navigated to a different page).
DeferredTask.jsm
this is always true when read from code inside the task function, but can also be true when read from external code, in case the task is an asyn
chronous generator function.
... set up a function or an asyn
chronous task whose execution can be triggered after a defined delay.
... a common use case occurs when a data structure should be saved into a file every time the data changes, using asyn
chronous calls, and multiple changes to the data may happen within a short time: let savedeferredtask = new deferredtask(function* () { yield os.file.writeatomic(...); // any uncaught exception will be reported.
Download
the cancellation request is asyn
chronous.
...this behavior is designed for the case where the call to cancel happens asyn
chronously, and is consistent with the case where the cancellation request could not be processed in time.
...this is required because cancellation and other operations are asyn
chronous.
NetUtil.jsm
methods asynccopy() the asynccopy() method performs a simple asyn
chronous copy of data from a source input stream to a destination output stream.
... } }) asyncfetch() the asyncfetch() method opens an input source, asyn
chronously, and gives an nsiinputstream containing the data obtained to the callback provided.
... asyncfetch( asource, acallback ); parameters asource the source to open asyn
chronously.
OS.File for the main thread
the content is read asyn
chronously.
...note that this snippet is useful as a demonstration of complex asyn
chronous programming with os.file – in most cases, function os.file.writeatomic is a better choice.
... let writestream = function writestream(data, outfile, chunksize) { let view = new uint8array(data); let loop = function loop(pos) { // define a recursive asyn
chronous loop.
OSFile.jsm
calling os.file from the main thread asyn
chronous, off-main thread file i/o, main thread api.
... calling os.file.directoryiterator from the main thread asyn
chronous, off-main thread file directory access, main thread api.
... os.file for workers syn
chronous file i/o for worker threads os.file.directoryiterator for workers visiting directories syn
chronously from a worker thread ...
Sqlite.jsm
all operations are asyn
chronous.
... use of syn
chronous storage apis is discouraged because they block the main thread.
... all the functionality in sqlite.jsm is asyn
chronous.
Nonblocking IO In NSPR
introduction previously, all i/o in the netscape portable runtime (nspr) was blocking (or syn
chronous).
... new socket nonblocking by using <tt>pr_setsockopt()</tt> as in the example below (error checking is omitted for clarity): <tt>prfiledesc *sock;</tt> <tt>printn optval = 1;</tt> <tt>sock = pr_newtcpsocket();</tt> /* * make the socket nonblocking */ pr_setsockopt(sock, pr_sockopt_nonblocking, &optval, sizeof(optval)); programming constraints there are some constraints due to the use of nt asyn
chronous i/o in the nspr.
...there is a second constraint, due to the use of nt asyn
chronous i/o and the recycling of used sockets: the new socket returned by <tt>pr_accept()</tt> or <tt>pr_acceptread()</tt> inherits the blocking/nonblocking io mode of the listening socket and this cannot be changed.
nsIAccessibleEvent
event_asynch_show 0x0004 a hidden object is shown -- this is a layout occurrence and is thus asyn
chronous.
... event_asynch_hide 0x0005 an object is hidden -- this is a layout occurrence and is thus asyn
chronous.
... event_asynch_significant_change 0x0006 an object had a significant layout change which could affect the type of accessible object -- this is a layout occurrence and is thus asyn
chronous.
nsIAsyncInputStream
if the stream implements nsiasyncinputstream, then the caller can use this interface to request an asyn
chronous notification when the stream becomes readable or closed (via the asyncwait() method).
... methods asyncwait() asyn
chronously wait for the stream to be readable or closed.
...aeventtarget specify null to receive notification on any thread (possibly even recursively on the calling thread, that is syn
chronously), or specify that the notification be delivered to a specific event target.
nsIAsyncOutputStream
if the stream implements nsiasyncoutputstream, then the caller can use this interface to request an asyn
chronous notification when the stream becomes writable or closed (via the asyncwait() method).
... methods asyncwait() asyn
chronously wait for the stream to be writable or closed.
...aeventtarget specify null to receive notification on any thread (possibly even recursively on the calling thread, that is syn
chronously), or specify that the notification be delivered to a specific event target.
nsIAuthPrompt2
it can be used to prompt users for authentication information, either syn
chronously or asyn
chronously.
... methods asyncpromptauth() asyn
chronously prompt the user for a username and password.
...this way we prevent multiple dialogs shown to the user because consumer may fall back to syn
chronous prompt on syn
chronous failure of this method.
nsIChannel
methods asyncopen() asyn
chronously open this channel.
... implementations are allowed to syn
chronously add themselves to the associated load group (if any).
... open() syn
chronously open the channel.
nsIChannelEventSink
note: prior to gecko 2.0, redirect handling was syn
chronous, using the onchannelredirect() method.
... starting in gecko 2.0, that method no longer exists, and instead the asynconchannelredirect() method is called; this uses a callback to handle redirects asyn
chronously.
...this callback can be done from within asynconchannelredirect() (effectively making the call syn
chronous) or at some point later (making the call asyn
chronous).
nsIDNSService
methods asyncresolve() begins off an asyn
chronous host lookup.
...resolve() called to syn
chronously resolve a host name.
...any pending asyn
chronous requests will be canceled, and the local cache of dns records will be cleared.
nsIJetpack
*/); void registerreceiver(in astring amessagename, in jsval areceiver); void unregisterreceiver(in astring amessagename, in jsval areceiver); void unregisterreceivers(in astring amessagename); void evalscript(in astring ascript); nsivariant createhandle(); void destroy(); methods sendmessage() this method asyn
chronously sends a message to the jetpack process.
...if the message was sent syn
chronously from the jetpack process via callmessage(), then the return value of this function is passed back to the jetpack process.
... evalscript() this asyn
chronously sends code to the jetpack process for evaluation.
nsIMicrosummaryService
the set might change after this method returns, since this method will trigger an asyn
chronous load of the page in question (if it isn't already loaded) to see if it references any page-specific microsummaries.
... the caller passes a bookmark id, and one of the microsummaries is the current one for the bookmark, this method will retrieve content from the datastore for that microsummary, which is useful when callers want to display a list of microsummaries for a page that isn't loaded, and they want to display the actual content of the selected microsummary immediately (rather than after the content is asyn
chronously loaded).
...otherwise, it'll asyn
chronously download the necessary information (the generator and/or page) before refreshing the microsummary.
nsIProtocolProxyService
proxy auto config (pac) may perform a syn
chronous dns query, which may not return immediately.
... asyncresolve() this method is an asy
chronous version of the resolve method.
... return value an nsicancelableobject that can be used to cancel the asyn
chronous operation.
nsIRequest
implementations must not send any notifications (for example via nsirequestobserver) syn
chronously from this function.
... similarly, removal from the load group (if any) must also happen asyn
chronously.
...ispending is true when there is an outstanding asyn
chronous event that will make the request no longer be pending.
nsISelection2
void scrollintoview(in short aregion, in boolean aissyn
chronous, in short avpercent, in short ahpercent); attributes attribute type description type short returns the type of the selection (see nsiselectioncontroller for available constants).
... void scrollintoview( in short aregion, in boolean aissyn
chronous, in short avpercent, in short ahpercent ); parameters aregion the region inside the selection to scroll into view (see selection region constants defined in nsiselectioncontroller).
... aissyn
chronous when true, scrolls the selection into view before returning.
nsISelectionPrivate
obsolete since gecko 12.0 long gettableselectiontype(in nsidomrange range); void removeselectionlistener(in nsiselectionlistener listenertoremove); void scrollintoview(in short aregion, in boolean aissyn
chronous, in short avpercent, in short ahpercent); void setancestorlimiter(in nsicontent acontent); native code only!
... void scrollintoview( in short aregion, in boolean aissyn
chronous, in short avpercent, in short ahpercent ); parameters aregion the region inside the selection to scroll into view (see selection region constants defined in nsiselectioncontroller).
... aissyn
chronous when true, scrolls the selection into view before returning.
nsIZipWriter
attempting to perform a syn
chronous operation on the interface while the background queue is in progress will throw an ns_error_in_progress exception.
...if the operation is performed on the queue then the channel will be opened asyn
chronously, otherwise the channel must support being opened syn
chronously.
... adding a file to a zip archive this code syn
chronously adds the file specified by the nsifile thefile to the zip archive.
MailNews Filters
in the case of pop3, filter execution is syn
chronous.
... for each new header, we evaluate the filter criteria and apply the actions syn
chronously, including moving a message to an other local folder, and advance to the next header.
... for imap, we tend to initiate the urls syn
chronously, but because we don't run two urls simultaneously on the same folder, the urls don't run until we've finished downloading headers.
Mail composition back end
all of these methods are asyn
chronous operations.
...these are critical for message delivery since message sending is asyn
chronous.
...this method is performs the send operations asyn
chronously.
Drawing and Event Handling - Plugins
if a plug-in calls one of these methods, it receives a paint message asyn
chronously.
...a plug-in can call npn_forceredraw() to force a paint message syn
chronously, once an area has been invalidated with npn_invalidaterect() or npn_invalidateregion().
... void npn_forceredraw(npp instance); this method results in a syn
chronous update event or paint message for the plug-in.
Clipboard - Web APIs
all of the clipboard api methods operate asyn
chronously; they return a promise which is resolved once the clipboard access has been completed.
...this asyn
chronous operation signals that it's finished by resolving the returned promise.
... clipboard availability the asyn
chronous clipboard api is a relatively recent addition, and the process of implementing it in browsers is not yet complete.
ContentIndex - Web APIs
// reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; } adding to the content index here we're declaring an item in the correct format and creating an asyn
chronous function which uses the add() method to register it with the content index.
... // our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisicing', description: 'repellat et quia iste possimus ducimus aliquid a aut eaque nostrum.', icons: [{ src: '/media/dark.png', sizes: '128x128', type: 'image/png', }], category: 'article' }; // our asyn
chronous function to add indexed content async function registercontent(data) { const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) { return; } // register content try { await registration.index.add(data); } catch (e) { console.log('failed to register content: ', e.message); } } retrieving items within the current index the below example shows an asyn
chronous function that retrieves ...
...cument.createelement('ul'); for (const entry of entries) { const listitem = document.createelement('li'); const anchorelem = document.createelement('a'); anchorelem.innertext = entry.title; anchorelem.setattribute('href', entry.url); listelem.append(listitem); } readinglistelem.append(listelem); } } unregistering indexed content below is an asyn
chronous function, that removes an item from the content index.
Content Index API - Web APIs
// reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; } adding to the content index here we're declaring an item in the correct format and creating an asyn
chronous function which uses the add() method to register it with the content index.
... // our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisicing', description: 'repellat et quia iste possimus ducimus aliquid a aut eaque nostrum.', icons: [{ src: '/media/dark.png', sizes: '128x128', type: 'image/png', }], category: 'article' }; // our asyn
chronous function to add indexed content async function registercontent(data) { const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) { return; } // register content try { await registration.index.add(data); } catch (e) { console.log('failed to register content: ', e.message); } } retrieving items within the current index the below example shows an asyn
chronous function that retrieves ...
...cument.createelement('ul'); for (const entry of entries) { const listitem = document.createelement('li'); const anchorelem = document.createelement('a'); anchorelem.innertext = entry.title; anchorelem.setattribute('href', entry.url); listelem.append(listitem); } readinglistelem.append(listelem); } } unregistering indexed content below is an asyn
chronous function, that removes an item from the content index.
Document: DOMContentLoaded event - Web APIs
syn
chronous javascript pauses parsing of the dom.
... if you want the dom to get parsed as fast as possible after the user has requested the page, you can make your javascript asyn
chronous and optimize loading of stylesheets.
... examples basic usage document.addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); delaying domcontentloaded <script> document.addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); for( let i = 0; i < 1000000000; i++) {} // this syn
chronous script is going to delay parsing of the dom, // so the domcontentloaded event is going to launch later.
Using files from web applications - Web APIs
next, we establish the filereader to handle asyn
chronously loading the image and attaching it to the img element.
...this can be done asyn
chronously very easily.
... asyn
chronously handling the file upload process this example, which uses php on the server side and javascript on the client side, demonstrates asyn
chronous uploading of a file.
HTMLImageElement.decoding - Web APIs
possible values are: sync: decode the image syn
chronously for atomic presentation with other content.
... async: decode the image asyn
chronously to reduce delay in presenting other content.
...if doing so would cause problems, you can specify sync to disable asyn
chronous loading.
HTMLScriptElement - Web APIs
there are three possible execution modes: if the async attribute is present, then the script will be executed asyn
chronously as soon as it downloads.
... note: when inserted using the document.write() method, <script> elements execute (typically syn
chronously), but when inserted using innerhtml or outerhtml, they do not execute at all.
...these scripts will be asyn
chronously executed.
History - Web APIs
back() this asyn
chronous method goes to the previous page in session history, the same action as when the user clicks the browser's back button.
... forward() this asyn
chronous method goes to the next page in session history, the same action as when the user clicks the browser's forward button; this is equivalent to history.go(1).
... go() asyn
chronously loads a page from the session history, identified by its relative location to the current page, for example -1 for the previous page or 1 for the next page.
WebGL best practices - Web APIs
geterror, getparameter) certain webgl entry points cause syn
chronous stalls on the calling thread.
... } } else { // program linking is syn
chronous.
... additionally, querying compile status is a syn
chronous call, which breaks pipelining.
Functions and classes available to Web Workers - Web APIs
across the network.) 39 (39) (mostly in 34 (34) behind pref, although a few features are later.) no support 42 41 behind pref 10.1 filereader this api allows asyn
chronous read of blob and file objects.
... 46 (46) no support (yes) no support filereadersync this api allows syn
chronous read of blob and file objects.
... (yes) (yes) (yes) (yes) promise javascript objects that allow you to write asyn
chronous functions.
WritableStream.WritableStream() - Web APIs
if this process is to be done asyn
chronously, it can return a promise to signal success or failure.
...if this process is asyn
chronous, it can return a promise to signal success or failure.
...if this process is asyn
chronous, it can return a promise to signal success or failure.
XMLDocument.async - Web APIs
document.async can be set to indicate whether a xmldocument.load() call should be an asyn
chronous or syn
chronous request.
... true is the default value, indicating that documents should be loaded asyn
chronously.
... (it has been possible to load documents syn
chronously since 1.4 alpha.) example function loadxmldata(e) { alert(new xmlserializer().serializetostring(e.target)); // gives querydata.xml contents as string } var xmldoc = document.implementation.createdocument("", "test", null); xmldoc.async = false; xmldoc.onload = loadxmldata; xmldoc.load('querydata.xml'); ...
XMLHttpRequest.open() - Web APIs
async optional an optional boolean parameter, defaulting to true, indicating whether or not to perform the operation asyn
chronously.
... note: syn
chronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated syn
chronous xhr support on the main thread entirely.
... syn
chronous requests are permitted in workers.
XMLHttpRequest.timeout - Web APIs
timeout shouldn't be used for syn
chronous xmlhttprequests requests used in a document environment or it will throw an invalidaccesserror exception.
... note: you may not use a timeout for syn
chronous requests with an owning window.
... using a timeout with an asyn
chronous request in internet explorer, the timeout property may be set only after calling the open() method and before calling the send() method.
WebAssembly.Instance() constructor - JavaScript
syntax important: since instantiation for large modules can be expensive, developers should only use the instance() constructor when syn
chronous instantiation is absolutely required; the asyn
chronous webassembly.instantiatestreaming() method should be used at all other times.
... examples syn
chronously instantiating a webassembly module the webassembly.instance() constructor function can be called to syn
chronously instantiate a given webassembly.module object, for example: const importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => { let mod = new webassembly.m...
...odule(bytes); let instance = new webassembly.instance(mod, importobject); instance.exports.exported_func(); }) however, the preferred way to get an instance is through the asyn
chronous webassembly.instantiatestreaming() function, for example like this: const importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); specifications specification webassembly javascript interfacethe definition of 'instance' in that specification.
WebAssembly Concepts - WebAssembly
the different code types can call each other as required — the webassembly javascript api wraps exported webassembly code with javascript functions that can be called normally, and webassembly code can import and syn
chronously call normal javascript functions.
...given a webassembly instance, javascript code can syn
chronously call its exports, which are exposed as normal javascript functions.
... arbitrary javascript functions can also be syn
chronously called by webassembly code by passing in those javascript functions as the imports to a webassembly instance.
content/worker - Archive of obsolete content
methods postmessage(data) asyn
chronously emits "message" events in the enclosed worker, where content script was loaded.
...calling the self.postmessage() function from a content script will asyn
chronously emit the message event on the corresponding worker.
places/history - Archive of obsolete content
usage this module exports a single function, search(), which syn
chronously returns a placesemitter object which then asyn
chronously emits data and end or error events that contain information about the state of the operation.
...// we'd compose the query with the following options let lastweek = date.now - (1000*60*60*24*7); search( // first query looks for all entries before last week with 'ruby' [{ query: "ruby", to: lastweek }, // second query searches all entries after last week with 'javascript' { query: "javascript", from: lastweek }], // we want to order
chronologically by visit date { sort: "date" } ).on("end", function (results) { // results is an array of objects containing visit data, // sorted by visit date, with all entries from more than a week ago // that contain 'ruby', *in addition to* entries from this last week // that contain 'javascript' }); globals functions search(queries, options) queries can be performed on history entrie...
Adding menus and submenus - Archive of obsolete content
it's best to show an item with a throbber image (see chrome://global/skin/icons/loading_16.png) so the user knows there's something going on, and asyn
chronously fill its contents.
... we'll look into some asyn
chronous techniques further ahead in the tutorial.
Sorting Results - Archive of obsolete content
for example, the date 'may 15' would appear after 'august 24' when sorted purely alphabetically but before it when sorted
chronologically.
...the builder will recognize this and sort
chronologically instead.
NPN_ForceRedraw - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary asks the plugin host to immediately (syn
chronously) repaint invalid areas.
...this causes a syn
chronous update event or paint message for the plug-in.
Version - Archive of obsolete content
they are listed in
chronological order of when they were released.
... note: in the list below, although rss 1.0 seems to be out of place, it is actually in the correct place
chronologically.
Archived JavaScript Reference - Archive of obsolete content
do not use it!array.observe()the array.observe() method was used for asyn
chronously observing changes to arrays, similar to object.observe() for objects.
... as firefox.number.tointeger()the number.tointeger() method used to evaluate the passed value and convert it to an integer, but its implementation has been removed.object.getnotifier()the object.getnotifer() method was used to create an object that allows to synthetically trigger a change, but has been deprecated and removed in browsers.object.observe()the object.observe() method was used for asyn
chronously observing the changes to an object.
Audio for Web games - Game development
loading your tracks with the web audio api you can load separate tracks and loops individually using xmlhttprequest or the fetch api, which means you can load them syn
chronously or in parallel.
... loading syn
chronously might mean parts of your music are ready earlier and you can start playing them while others load.
Ajax - MDN Web Docs Glossary: Definitions of Web-related terms
ajax, which initially stood for asyn
chronous javascript and xml, is a programming practice of building complex, dynamic webpages using a technology known as xmlhttprequest.
...ajax also lets you work asyn
chronously, meaning your code continues to run while the targeted part of your web page is trying to reload (compared to syn
chronously, which blocks your code from running until that part of your page is done reloading).
Callback function - MDN Web Docs Glossary: Definitions of Web-related terms
here is a quick example: function greeting(name) { alert('hello ' + name); } function processuserinput(callback) { var name = prompt('please enter your name.'); callback(name); } processuserinput(greeting); the above example is a syn
chronous callback, as it is executed immediately.
... note, however, that callbacks are often used to continue code execution after an asyn
chronous operation has completed — these are called asyn
chronous callbacks.
MDN Web Docs Glossary: Definitions of Web-related terms
abstraction accessibility accessibility tree (aom) adobe flash ajax algorithm alignment container alignment subject alpha (alpha channel) alpn api apple safari application context argument aria arpa arpanet array ascii asyn
chronous atag attribute b bandwidth base64 baseline beacon bézier curve bidi bigint blink block block (css) block (scripting) block cipher mode of operation boolean boot2gecko bootstrap bounding box breadcrumb ...
...ion speculative parsing speed index sql sql injection sri stacking context state machine statement static method static typing strict mode string stun style origin stylesheet svg svn symbol symmetric-key cryptography syn
chronous syntax syntax error synthetic monitoring t tag tcp tcp handshake tcp slow start telnet texel thread three js time to first byte time to interactive tld tofu transmission control protocol (tcp) transport layer security (tls) ...
Client-side storage - Learn web development
you don't want to hang the browser while you wait for the results, so database operations are asyn
chronous, meaning that instead of happening immediately, they will happen at some point in the future, and you get notified when they're done.
... we have a problem here though — these two requests are both asyn
chronous, but we only want to try to display or store the video when both promises have fulfilled.
Multimedia: Images - Learn web development
optimizing image delivery despite being the largest consumer of bandwidth, images load asyn
chronously so the visitor can see the page as they download and therefore, their impact on perceived performance is far lower than many expect.
... rendering strategy as images are loaded asyn
chronously and continue to load after the first paint, if their dimensions aren't defined before load, they can cause reflows to the page content.
Web performance resources - Learn web development
as we learned in the critical rendering path document, linking css with a tradional link tag with rel="stylesheet" is syn
chronous and blocks rendering.
... to load css asyn
chronously one can simpy set the media type to print and then change to all once loaded.
Handling common JavaScript problems - Learn web development
making sure asyn
chronous operations have returned before trying to use the values they return.
... for example: promises are a great new feature for performing asyn
chronous operations and making sure those operations are complete before code that relies on their results is used for something else.
Browser chrome tests
asyn
chronous tests when writing async tests, you can use the add_task method with promises.
... the test suite also supports asyn
chronous tests, using the same function names as mochitest.
Frame script environment
sendasyncmessage() send an asyn
chronous message to chrome.
... sendsyncmessage() send a syn
chronous message to chrome.
Frame script environment
sendasyncmessage() send an asyn
chronous message to chrome.
... sendsyncmessage() send a syn
chronous message to chrome.
Message manager overview
its most important attributes and functions are: content : access the dom window hosted by the tab docshell : access the top-level docshell components : access privileged objects and apis addeventlistener() : listen to dom events addmessagelistener() : receive messages from the chrome process sendasyncmessage() : send asyn
chronous messages to the chrome process sendsyncmessage() : send syn
chronous messages to the chrome process interfaces nsidomeventtarget nsimessagelistenermanager nsimessagesender nsisyncmessagesender nsicontentframemessagemanager how to access the content frame message manager is the global object in frame scripts.
... its most important attributes and functions are: components : access privileged objects and apis addmessagelistener() : receive messages from the parent process sendasyncmessage() : send asyn
chronous messages to the parent process sendsyncmessage() : send syn
chronous messages to the parent process interfaces nsimessagelistenermanager nsimessagesender nsisyncmessagesender nsicontentprocessmessagemanager how to access code running in a child process can access the cpmm with code like this: // child process script let cpmm = c...
HTTP Cache
nsicacheentry //github.com/realityripple/uxp/blob/master/netwerk/cache2/nsicacheentry.idl obtained asyn
chronously or pseudo-asyn
chronously by a call to nsicachestorage.asyncopenuri.
...is created as 'new', state = empty otherwise: cachefile is created and load on it started cacheentry::onfileready notification is now expected state == loading: just do nothing and exit call to cacheentry::invokecallbacks cacheentry::invokecallbacks (entry atomic): called on: a new opener has been added to the fifo via an asyncopen call asyn
chronous result of cachefile open the writer throws the entry away the output stream of the entry has been opened or closed metadataready or setvalid on the entry has been called the entry has been doomed state == empty: on oper_readonly flag use: oncacheentryavailable with null for the cache entry otherwise: state = writing opener is removed from the fifo and r...
Introduction to Layout in Mozilla
(tables, blocks, xul boxes) reflow “global” reflows initial, resize, style-change processed immediately via presshell method incremental reflows targeted at a specific frame dirty, content-changed, style-changed, user-defined nshtmlreflowcommand object encapsulates info queued and processed asyn
chronously, nsipressshell::appendreflowcommand, processreflowcommands incremental reflow recursively descend to target recovering reflow state child rs.reason set to incremental incremental reflow process reflow “normally” at target frame child rs.reason set based on rc’s type incremental reflow propagate damage to frames later “in the flow” ...
... incremental reflow multiple reflow commands are batched nsreflowpath maintains a tree of target frames amortize state recovery and damage propagation cost painting as reflow proceeds through the frame hierarchy, areas are invalidated via nsiviewmanager::updateview unless immediate, invalid areas are coalesced and processed asyn
chronously via os expose event native expose event dispatched to widget; widget delegates to the view manager view manager paints views back-to-front, invoking presshell’s paint method presshell::paint walks from the view to the frame; invokes nsiframe::paint for each layer incrementalism single-threaded simple (no locking) can’t leave event queue unattended content construction unwinds “at will” ...
Add-on Manager
many functions in the add-on manager interface operate asyn
chronously returning results through callbacks passed to the functions.
...all of its functions are asyn
chronous, meaning that a callback function must be passed to receive the addon instances.
Promise
a reference to an existing promise may be received by different means, for example as the return value of a call into an asyn
chronous api.
... promise catch( function onreject ); the following calls are therefore identical: p.then(undefined, logerror); p.catch(logerror); debugging by design, the instant state and value of a promise cannot be inspected syn
chronously from code, without calling the then() method.
Task.jsm
the task.jsm javascript code module implements a subset of task.js to make sequential, asyn
chronous operations simple, using the power of javascript's yield operator.
... we can easily loop while // calling asyn
chronous functions, and wait multiple times.
JavaScript code modules
netutil.jsm provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asyn
chronously.
... task.jsm implements a subset of task.js to make sequential, asyn
chronous operations simple, using the power of javascript's yield operator.
Profiling with the Firefox Profiler
black: these indicate syn
chronous ipc calls.
... syn
chronous re-flow can be caused by js that, for example, makes changes to the page content in a loop and queries about the layout of the page in that same loop.
HTTP delegation
the api should allow nss to use the http client either asyn
chronously or syn
chronously.
...please read the source code documentation to learn how to use this api syn
chronously or asyn
chronously.
HTTP delegation
the api should allow nss to use the http client either asyn
chronously or syn
chronously.
...please read the source code documentation to learn how to use this api syn
chronously or asyn
chronously.
Multithreading in Necko
when a socket can be read, the socket's listener is notified either syn
chronously (on the same thread) or asyn
chronously via a nsistreamlistenerproxy impl.
...for example, on xp_win an invisible window is created with a message pump on a background thread for processing wsa asyn
chronous dns events.
Redis Tips
in node, create client with explicit host and port like so: > var r = require('redis').createclient(6379, '127.0.0.1') commands are asyn
chronous.
... > r.set('foo', 42, console.log) null 'ok' > r.get('foo', console.log) null '42' for the rest of this, i'm going to use the syn
chronous redis-cli for demonstrations.
Components.isSuccessCode
however, if you are using asyn
chronous apis, it may be essential.
... for example, if you ask a component or service to asyn
chronously perform some task, you must usually pass in an object which will be notified when the task is completed.
imgIRequest
note that cancel() is asyn
chronous, which means that some time after you call it, the listener/observer will get an onstoprequest().
...aobserver will be notified syn
chronously (before the clone call returns) with all the notifications that have already been dispatched for this image load.
mozIAsyncFavicons
toolkit/components/places/moziasyncfavicons.idlscriptable interface for accessing the favicon service asyn
chronously.
... setandfetchfaviconforpage() declares that a given page uses a favicon with the given uri and attempts to fetch and save the icon data by loading the favicon uri through a asyn
chronous network request.
mozIAsyncHistory
.getservice(components.interfaces.moziasynchistory); method overview void getplacesinfo(in jsval aplaceidentifiers, in mozivisitinfocallback acallback); void isurivisited(in nsiuri auri, in mozivisitedstatuscallback acallback); void updateplaces(in moziplaceinfo, [optional] in mozivisitinfocallback acallback); methods getplacesinfo() starts an asyn
chronous request to determine whether or not a given uri has been visited; you must implement a callback to receive the result of the request.
... isurivisited() starts an asyn
chronous request to determine whether or not a given uri has been visited; you must implement a callback to receive the result of the request.
mozIStorageCompletionCallback
this interface should be implemented to handle callbacks from asyn
chronous storage api routines.
... last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports method overview void complete(); methods complete() called when an asyn
chronous storage routine has completed.
mozIStorageStatementCallback
the mozistoragestatementcallback interface represents a callback handler that the storage api calls with result, error, and completion notifications while handling asyn
chronous database queries.
...this function may be called more than once with a different storageierror each time for any given asyn
chronous statement, and handlecompletion will be called once the statement is complete.
nsIAppShell
runinstablestate() allows running of a "syn
chronous section", in the form of an nsirunnable once the event loop has reached a "stable state".
... a stable state is reached when the currently executing task/event has finished, (see: webappapis.html#syn
chronous-section).
nsIAsyncVerifyRedirectCallback
netwerk/base/public/nsiasyncverifyredirectcallback.idlscriptable implement this interface to receive a callback that lets you know whether an asyn
chronous redirect was verified or vetoed.
... method overview void onredirectverifycallback(in nsresult result); methods onredirectverifycallback() implements the asyn
chronous callback passed to nsichanneleventsink.asynconchannelredirect().
nsIAutoCompleteSearch
results can be sent to the listener either syn
chronously or asyn
chronously, depending on the implementation.
... method overview void startsearch(in astring searchstring, in astring searchparam, in nsiautocompleteresult previousresult, in nsiautocompleteobserver listener); void stopsearch(); methods startsearch() search for a given string and notify a listener (either syn
chronously or asyn
chronously) of the result.
nsIBrowserSearchService
to access this service, use: var browsersearchservice = components.classes["@mozilla.org/browser/search-service;1"] .getservice(components.interfaces.nsibrowsersearchservice); attempting to use any method or attribute of this interface before init() has completed will force the service to fall back to a slower, syn
chronous, initialization.
... attempting to call any method of this interface before init() has completed will force the service to fall back to a slower, syn
chronous, initialization.
nsICache
non_blocking 0 the syn
chronous opencacheentry() may be blocking or non-blocking.
... blocking 1 the syn
chronous opencacheentry() may be blocking or non-blocking.
nsICacheEntryDescriptor
use the stream transport service to asyn
chronously read this stream on a background thread.
...use the stream transport service to asyn
chronously write to this stream on a background thread.
nsIDownloadManager
note: prior to gecko 12.0, this was a syn
chronous operation; that is, once this method returned, you knew that the download was in the download manager's list.
...adding downloads to the download manager is now an asyn
chronous operation.
nsIEventTarget
dispatch_sync 1 this flag specifies the syn
chronous mode of event dispatch, in which the dispatch() method does not return until the event has been processed.
...method for posting an asyn
chronous event to the event target.
nsIFaviconService
note: this is an asyn
chronous operation; when it completes, a "places-favicons-expired" notification is dispatched through the observer's service.
...an async request will be created for this uri and if the data is available, it will asyn
chronously get saved in the database without any further work from the caller.
nsIFeedProcessor
methods parseasync() parses a feed asyn
chronously.
...you must not call any of the other parsing methods on the nsifeedprocessor interface during an asyn
chronous parse.
nsIFrameMessageListener
sync a boolean value indicating whether or not the message should be handled syn
chronously.
... json the json object in which to return the response if the message is being handled syn
chronously.
nsIMessageListener
if the message is syn
chronous, the possible return value is returned as json (will be changed to use structured clones).
... when there are multiple listeners to syn
chronous messages, each listener's return value is sent back as an element in an array.
nsINavHistoryQueryOptions
asyncenabled boolean when true, the root container node generated by these options and all of its descendant containers are opened asyn
chronously if they support doing so.
... note: currently, only bookmark folder containers support being opened asyn
chronously.
nsIProcess
runasync() asyn
chronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running.
... runwasync() asyn
chronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running.
nsIProgressEventSink
netwerk/base/public/nsiprogresseventsink.idlscriptable this interface is used to asyn
chronously convey channel status and progress information that is generally not critical to the processing of the channel.
... inherits from: nsisupports last changed in gecko 1.7 this interface is used to asyn
chronously convey channel status and progress information that is generally not critical to the processing of the channel.
nsIRequestObserver
inherits from: nsisupports last changed in gecko 1.0 method overview void onstartrequest(in nsirequest arequest, in nsisupports acontext); void onstoprequest(in nsirequest arequest, in nsisupports acontext, in nsresult astatuscode); methods onstartrequest() called to signify the beginning of an asyn
chronous request.
... onstoprequest() called to signify the end of an asyn
chronous request.
nsISelectionController
selection_on 2 selection_disabled 3 selection_attention 4 scroll constants constant value description scroll_syn
chronous 1<<1 if set scrolls the selection into view before returning.
...note: if issyn
chronous is true, calling this method may flush the pending reflow.
nsIServerSocket
it will asyn
chronously listen for and accept client connections.
...this will cause the onstoplistening event to asyn
chronously fire with a status of ns_binding_aborted.
nsIThread
warning: calling nsithread.processnextevent allows network and ui events to run which can modify data structures that your code isn't expecting to be modified during a syn
chronous method call.
...consider use asyn
chronous callbacks instead.
Mail and RDF
asyn
chronously notifying rdf when the data itself changes, rdf needs to be notified.
...etresource("http://home.netscape.com/nc-rdf#totalmessages"); function gettarget(target, property, unused) { var folder = target.queryinterface(components.interfaces.nsimsgfolder); if (property == msgcountarc) { var msgcount = folder.gettotalmessages(false); var result = rdf.getliteral(msgcount.tostring()); return result; } } asyn
chronously notifying rdf when a mail object's data changes and the data is reflected in rdf by notifying all of the observers that rdf has registered with the datasource.
Frame rate - Firefox Developer Tools
a frame rate of 60fps is reckoned to be the target for smooth performance, giving you a time budget of 16.7ms for all the updates that need to be made syn
chronously in response to some event.
...the intensive javascript article shows how you can use strategies like this to fix responsiveness problems caused by long-running syn
chronous javascript.
ContentIndex.add() - Web APIs
examples here we're declaring an item in the correct format and creating an asyn
chronous function which uses the add method to register it with the content index.
... // our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisicing', description: 'repellat et quia iste possimus ducimus aliquid a aut eaque nostrum.', icons: [{ src: '/media/dark.png', sizes: '128x128', type: 'image/png', }], category: 'article' }; // our asyn
chronous function to add indexed content async function registercontent(data) { const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) { return; } // register content try { await registration.index.add(data); } catch (e) { console.log('failed to register content: ', e.message); } } the add method can also be used within the service worker scope.
Element - Web APIs
element.requestfullscreen() asyn
chronously asks the browser to make the element full-screen.
... element.requestpointerlock() allows to asyn
chronously ask for the pointer to be locked on the given element.
EventTarget.dispatchEvent() - Web APIs
dispatches an event at the specified eventtarget, (syn
chronously) invoking the affected eventlisteners in the appropriate order.
... notes unlike "native" events, which are fired by the dom and invoke event handlers asyn
chronously via the event loop, dispatchevent() invokes event handlers syn
chronously.
Fetch basic concepts - Web APIs
in a nutshell at the heart of fetch are the interface abstractions of http requests, responses, headers, and body payloads, along with a global fetch method for initiating asyn
chronous resource requests.
... fetch takes the asyn
chronous nature of such requests one step further.
FileException - Web APIs
in the file system api, a fileexception object represents error conditions that you might encounter while accessing the file system using the syn
chronous api.
... basic concepts syn
chronous apis do not have error callbacks, which makes it difficult to catch errors.
FileReaderSync.readAsArrayBuffer() - Web APIs
the readasarraybuffer() method of the filereadersync interface allows to read file or blob objects in a syn
chronous way into an arraybuffer.
... this interface is only available in workers as it enables syn
chronous i/o that could potentially block.
FileReaderSync.readAsBinaryString() - Web APIs
the readasbinarystring() method of the filereadersync interface allows to read file or blob objects in a syn
chronous way into an domstring.
... this interface is only available in workers as it enables syn
chronous i/o that could potentially block.
FileReaderSync.readAsDataURL() - Web APIs
the readasdataurl() method of the filereadersync interface allows to read file or blob objects in a syn
chronous way into an domstring representing a data url.
... this interface is only available in workers as it enables syn
chronous i/o that could potentially block.
FileReaderSync.readAsText() - Web APIs
the readastext() method of the filereadersync interface allows to read file or blob objects in a syn
chronous way into an domstring.
... this interface is only available in workers as it enables syn
chronous i/o that could potentially block.
FileReaderSync - Web APIs
the filereadersync interface allows to read file or blob objects syn
chronously.
... this interface is only available in workers as it enables syn
chronous i/o that could potentially block.
HTMLMediaElement.seekToNextFrame() - Web APIs
the htmlmediaelement.seektonextframe() method asyn
chronously advances the the current play position to the next frame in the media.
... firefox 49 returns undefined instead of a promise, and performs the seek operation syn
chronously.
IDBCursorSync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
...it enables an application to syn
chronously process all the records in the cursor's range.
IDBDatabaseSync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
... the databasesync interface in the indexeddb api represents a syn
chronous connection to a database.
IDBEnvironment - Web APIs
properties idbenvironment.indexeddb read only provides a mechanism for applications to asyn
chronously access capabilities of indexed databases; contains an idbfactory object.
... example the following code creates a request for a database to be opened asy
chronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open("todolist"); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; }; } browser compatibility the compatibility table on this page is generated from structured data.
IDBEnvironmentSync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
... attributes attribute type description indexeddbsync readonly idbfactorysync provides a syn
chronous means of accessing the capabilities of indexed databases.
IDBFactorySync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
... the idbfactorysync interface of the indexeddb api provide a syn
chronous means of accessing the capabilities of indexed databases.
IDBIndexSync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
... the idbindexsync interface of the indexeddb api provides syn
chronous access to an index in a database.
IDBObjectStoreSync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
... the idbobjectstoresync interface of the indexeddb api provides syn
chronous access to an object store of a database.
IDBTransactionSync - Web APIs
important: the syn
chronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable.
... the idbtransactionsync interface of the indexeddb api provides a syn
chronous transaction on a database.
Intersection Observer API - Web APIs
the intersection observer api provides a way to asyn
chronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.
...each observer can asyn
chronously observe changes in the intersection between one or more target elements and a shared ancestor element or with their top-level document's viewport.
LocalFileSystemSync - Web APIs
for more concepts, see the counterpart article for the asyn
chronous api.
... var fs = requestfilesystemsync(temporary, 1024*1024 /*1mb*/); because you are using a syn
chronous api, you don't need success and error callbacks.
OffscreenCanvas - Web APIs
examples syn
chronous display of frames produced by an offscreencanvas one way to use the offscreencanvas api, is to use a renderingcontext that has been obtained from an offscreencanvas object to generate new frames.
... // commit rendering to the second canvas var bitmaptwo = offscreen.transfertoimagebitmap(); two.transferfromimagebitmap(bitmaptwo); asyn
chronous display of frames produced by an offscreencanvas another way to use the offscreencanvas api, is to call transfercontroltooffscreen() on a <canvas> element, either on a worker or the main thread, which will return an offscreencanvas object from an htmlcanvaselement object from the main thread.
ReadableStream.ReadableStream() - Web APIs
if this process is to be done asyn
chronously, it can return a promise to signal success or failure.
...if this process is asyn
chronous, it can return a promise to signal success or failure.
SVGImageElement.decoding - Web APIs
possible values are: sync: decode the image syn
chronously for atomic presentation with other content.
... async: decode the image asyn
chronously to reduce delay in presenting other content.
SourceBuffer.removeAsync() - Web APIs
the removeasync() method of the sourcebuffer interface starts the process of asyn
chronously removing from the sourcebuffer media segments found within a specific time range.
... example this example establishes an asyn
chronous function, emptysourcebuffer(), which simply clears the contents of the specified sourcebuffer.
SourceBuffer - Web APIs
sourcebuffer.appendbufferasync() starts the process of asyn
chronously appending the specified buffer to the sourcebuffer.
... sourcebuffer.removeasync() starts the process of asyn
chronously removing media segments in the specified range from the sourcebuffer.
USBDevice - Web APIs
usbdevice.iso
chronoustransferin() returns a promise that resolves with a usbiso
chronousintransferresult when time sensitive information has been transmitted to the usb device.
... usbdevice.iso
chronoustransferout() returns a promise that resolves with a usbiso
chronousouttransferresult when time sensitive information has been transmitted from the usb device.
WebGL2RenderingContext - Web APIs
webgl2renderingcontext.beginquery() begins an asyn
chronous query.
... webgl2renderingcontext.endquery() marks the end of an asyn
chronous query.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
to avoid races, we'll use this value later instead of the signaling state to determine whether or not an offer is being processed because the value of signalingstate changes asyn
chronously, introducing a glare opportunity.
... the old way consider this onnegotiationneeded event handler: pc.onnegotiationneeded = async () => { try { await pc.setlocaldescription(await pc.createoffer()); signaler.send({description: pc.localdescription}); } catch(err) { console.error(err); } }; because the createoffer() method is asyn
chronous and takes some time to complete, there's time in which the remote peer might attempt to send an offer of its own, causing us to leave the stable state and enter the have-remote-offer state, which means we are now waiting for a response to the offer.
WindowOrWorkerGlobalScope.indexedDB - Web APIs
the indexeddb read-only property of the windoworworkerglobalscope mixin provides a mechanism for applications to asyn
chronously access the capabilities of indexed databases.
... example the following code creates a request for a database to be opened asy
chronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification.
Sending and Receiving Binary Data - Web APIs
firefox-specific examples this example transmits binary content asyn
chronously, using the post method, and firefox's non-standard sendasbinary().
...g/mime;1"] .getservice(components.interfaces.nsimimeservice); mimetype = mimeservice.gettypefromfile(file); // file is an nsifile instance } catch (oevent) { /* eat it; just use text/plain */ } // send var req = components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] .createinstance(components.interfaces.nsixmlhttprequest); req.open('put', url, false); /* syn
chronous!
XMLHttpRequest.send() - Web APIs
if the request is asyn
chronous (which is the default), this method returns as soon as the request is sent and the result is delivered using events.
... if the request is syn
chronous, this method doesn't return until the response has arrived.
WAI ARIA Live Regions/API Support - Developer guides
this information is retrieved differently on each platform, because some platforms use asyn
chronous events.
...they are syn
chronous with what the user is doing and can thus likely be read without disorienting the user.
Ajax - Developer guides
asyn
chronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together, including html or xhtml, css, javascript, dom, xml, xslt, and most importantly the xmlhttprequest object.
... filereader api the filereader api lets web applications asyn
chronously read the contents of files (or raw data buffers) stored on the user's computer, using file or blob objects to specify the file or data to read.
Index - Developer guides
2 ajax ajax, dom, json, javascript, references, xmlhttprequest asyn
chronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together 3 community ajax if you know of useful mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here.
... 17 event developer guide dom, event, guide, needsupdate, events events refers both to a design pattern used for the asyn
chronous handling of various incidents which occur in the lifetime of a web page and to the naming, characterization, and use of a large number of incidents of different types.
Feature Policy - HTTP
block the use of outdated apis like syn
chronous xhr and document.write().
... the features include: layout-inducing animations legacy image formats oversized images syn
chronous scripts syn
chronous xmlhttprequest unoptimized images unsized media granular control over certain features the web provides functionality and apis that may have privacy or security risks if abused.
Feature-Policy: sync-xhr - HTTP
the http feature-policy header sync-xhr directive controls whether the current document is allowed to make syn
chronous xmlhttprequest requests.
... default policy by default the policy is set to *, which means syn
chronous requests are allowed in all frames.
HTTP Index - HTTP
144 feature-policy: sync-xhr directive, feature policy, feature-policy, http, reference, xmlhttprequest the http feature-policy header sync-xhr directive controls whether the current document is allowed to make syn
chronous xmlhttprequest requests.
...it is non-committal, meaning that there is no way for the http to later send an asyn
chronous response indicating the outcome of processing the request.
Concurrency model and the event loop - JavaScript
event loop the event loop got its name because of how it's usually implemented, which usually resembles: while (queue.waitformessage()) { queue.processnextmessage() } queue.waitformessage() waits syn
chronously for a message to arrive (if one is not already available and waiting to be handled).
... legacy exceptions exist like alert or syn
chronous xhr, but it is considered a good practice to avoid them.
Promise.allSettled() - JavaScript
it is typically used when you have multiple asyn
chronous tasks that are not dependent on one another to complete successfully, or you'd always like to know the result of each promise.
... return value a pending promise that will be asyn
chronously fulfilled once every promise in the specified collection of promises has completed, either by successfully being fulfilled or by being rejected.
WebAssembly.Instance - JavaScript
examples syn
chronously instantiating a webassembly module the webassembly.instance() constructor function can be called to syn
chronously instantiate a given webassembly.module object, for example: const importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => { let mod = new webassembly.m...
...odule(bytes); let instance = new webassembly.instance(mod, importobject); instance.exports.exported_func(); }) the preferred way to get an instance is asyn
chronously, for example using the webassembly.instantiatestreaming() function like this: const importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); this also demonstrates how the exports property is used to access exported functions.
Communicating using "port" - Archive of obsolete content
to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asyn
chronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing.
Content Scripts - Archive of obsolete content
to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asyn
chronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing.
passwords - Archive of obsolete content
server at http://www.example.com requested authentication with a response code like this: http/1.0 401 authorization required server: apache/1.3.27 www-authenticate: basic realm="exampleco login" the corresponding values for the credential (excluding username and password) should be: url: "http://www.example.com" realm: "exampleco login" oncomplete and onerror this api is explicitly asyn
chronous, so all its functions take two callback functions as additional options: oncomplete and onerror.
content/symbiont - Archive of obsolete content
usage a symbiont loads the specified contenturl and content scripts into a frame, and sets up an asyn
chronous channel between the content scripts and the add-on code, enabling them to exchange messages using the port or postmessage apis.
places/bookmarks - Archive of obsolete content
save() and search() are both asyn
chronous functions: they syn
chronously return a placesemitter object, which then asyn
chronously emits events as the operation progresses and completes.
Open a Web Page - Archive of obsolete content
to open a new web page, you can use the tabs module: var tabs = require("sdk/tabs"); tabs.open("http://www.example.com"); this function is asyn
chronous, so you don't immediately get back a tab object which you can examine.
Miscellaneous - Archive of obsolete content
plication running us services.appinfo.name; // returns "firefox" for firefox services.appinfo.version; // returns "2.0.0.1" for firefox version 2.0.0.1 retrieving the version of an extension as specified in the extension's install.rdf components.utils.import("resource://gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("extension-guid@example.org", function(addon) { // this is an asyn
chronous callback function that might not be called immediately alert("my extension's version is " + addon.version); }); restarting firefox/thunderbird/seamonkey_2.0 for firefox 3 see onwizardfinish around here: http://mxr.mozilla.org/seamonkey/sou...pdates.js#1639 for firefox 2 see around here: http://mxr.mozilla.org/mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by ...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
nevertheless, the rise of web services like google maps, which used javascript and asyn
chronous communications, created an awareness of a set of technologies nicknamed ajax (asyn
chronous javascript and xml); that plus the advent of a number of libraries that paper over implementation differences between different web browsers has more recently led to a re-evaluation of javascript as a programming language.
Using the Stylesheet Service - Archive of obsolete content
t-service;1"] .getservice(components.interfaces.nsistylesheetservice); var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("chrome://myext/content/myext.css", null, null); sss.loadandregistersheet(uri, sss.user_sheet); note: loadandregistersheet will load the stylesheet syn
chronously, so you should only call this method using local uris.
Me - Archive of obsolete content
onfirstrun() may be called anywhere in your jetpack, but if it is called as the result of some asyn
chronous operation such as a timeout or xmlhttprequest, it is ignored.
DOM Interfaces - Archive of obsolete content
loadbindingdocument the loadbindingdocument method can be used to syn
chronously obtain the specified binding document for use within a particular document (the one on which the loadbindingdocument method was invoked).
Using the Editor from XUL - Archive of obsolete content
we get the url to load from the args element, then kick off the load: var url = document.getelementbyid("args").getattribute("value"); editorshell.loadurl(url); loading the document in the <iframe> of course happens asyn
chronously, so we need to know when we have a document that we can start editing.
2006-10-27 - Archive of obsolete content
he recommends that a non-xpcshell environment is needed really badly, but the big issue is that the xpcshell doesn't have an event loop, so nothing asyn
chronous can be tested.
2006-11-10 - Archive of obsolete content
discussions developing an extension like xmlhttprequest / nsidocument / mozilla_internal_api a discussion on how to develop an extension similar to xmlhttprequest but for a different protocol than http, emulating the asyn
chronous aspect.
Async scripts for asm.js - Game development
instead of using eval or innerhtml, both of which trigger syn
chronous compilation, you should use a blob with an object url: var blob = new blob([codestring]); var script = document.createelement('script'); var url = url.createobjecturl(blob); script.onload = script.onerror = function() { url.revokeobjecturl(url); }; script.src = url; document.body.appendchild(script); the setting of src rather than innerhtml is what makes this script async.
Front-end web developer - Learn web development
modules javascript first steps (30–40 hour read/exercises) javascript building blocks (25–35 hour read/exercises) introducing javascript objects (25–35 hour read/exercises) client-side web apis (30–40 hour read/exercises) asyn
chronous javascript (25–35 hour read/exercises) web forms — working with user data time to complete: 40–50 hours prerequisites forms require html, css, and javascript knowledge.
What is web performance? - Learn web development
it is important to minimize the loading and response times, and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asyn
chronously loading in the longer tail parts of the experience.
Accessibility/LiveRegionDevGuide
it is responsible for queuing messages derived from live region events, where priority is determined by
chronological order and the live politeness properties.
Gecko info for Windows accessibility vendors
ajax: asyn
chronous javascript and xml ajax is a method of building interactive web applications that process user requests, user actions immediately in real time, unlike an http request, during which users must wait for a whole page to reload or for a new page to load.
Debugging OpenGL
this flushes out each call, essentially turning opengl into a syn
chronous api.
OS.File.Info
using os.file.info example: determining if a file is a regular file the following snippet uses the main thread api to determine (asyn
chronously) whether some path is a regular file, or a directory, or a symbolic link: let promise = os.file.stat(somepath); promise.then( function onsuccess(info) { // |info| is an instance of |os.file.info| if (info.isdir) { // |somepath| represents a directory } else if (info.issymlink) { // |somepath| represents a symbolic link } else { // |somepath| represents a regul...
Examples
function promisevalueaftertimeout(avalue, atimeout) { let deferred = promise.defer(); try { // an asyn
chronous operation will trigger the resolution of the promise.
Promise.jsm
a reference to an existing promise may be received by different means, for example as the return value of a call into an asyn
chronous api.
WebRequest.jsm
in particular, "blocking" may be passed to several event types, and will make the event dispatch syn
chronous, so the browser will wait for the event listener to return before continuing with the request.
GPU performance
doing performance work with gpus is harder than with cpus because of the asyn
chronous and massively parallel architecture.
MailNews automated testing
testing frameworks the asynctestutils extended framework supports: asyn
chronous test operation: a reasonably convenient means of writing tests that involve asyn
chronous operations by using generators.
About NSPR
it was originally intended to export syn
chronous i/o methods only, relying on threads to provide the concurrency needed for complex applications.
PR_JoinThread
the function is syn
chronous in that it blocks the calling thread until the target thread is in a joinable state.
Necko Interfaces Overview
completes load groups in gecko own all channels used to load a particular page (until the channels complete) all channels owned by a load group can be canceled at once via the load group's nsirequest::cancel method nsitransport represents a physical connection, such as a file descriptor or a socket used directly by protocol handler implementations (as well as by mailnews and chatzilla) syn
chronous i/o methods: openinputstream, openoutputstream asyn
chronous i/o methods: asyncread, asyncwrite nsitransport::asyncread takes a nsistreamlistener parameter original document information author(s): darin fisher last updated date: december 10, 2001 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creativ...
Necko walkthrough
has onstartrequest, onstoprequest, ondataavailable, the three functions in which channel responses are received asyn
chronously.
Bytecode Descriptions
asyncawait stack: value, gen ⇒ promise arrange for this async function to resume asyn
chronously when value becomes resolved.
Gecko events
is supported: yes event_asynch_show a hidden object is shown -- this is a layout occurance and is thus asyn
chronous is supported: yes event_asynch_hide an object is hidden -- this is a layout occurance and is thus asyn
chronous is supported: yes event_asynch_significant_change an object had a significant layout change which could affect the type of accessible object -- this is a layout occurance and is thus asyn
chronous is supported: yes event_active_decendent_changed the active descendant of a componen...
History Service Design
in future this will probably change in favour of storage asyn
chronous statements, so that the inserts will be queued-up by mozstorage itself in a separate thread.
HOWTO
async network requests problem you want to make network requests or do other asyn
chronous work in xpcshell.
Observer Notifications
http-on-opening-request similar to http-on-modify-request, but called earlier (syn
chronously during the channel's asyncopen() call), and some channel attributes (proxyinfo) may be missing.
imgIContainer
flag_sync_decode: forces syn
chronous/non-progressive decode of all available data before the call returns.
imgIDecoderObserver
decode notifications may or may not be syn
chronous, depending on the situation.
mozIJSSubScriptLoader
method overview jsval loadsubscript(in string url, in object targetobj optional, in string charset optional); jsval loadsubscriptwithoptions(in string url, in object options); methods loadsubscript() syn
chronously loads and executes the script from the specified url.
mozIStoragePendingStatement
the mozistoragependingstatement interface represents a pending asyn
chronous database statement, and offers the cancel() method which allows you to cancel the pending statement.
mozIStorageStatement
executeasync() starts the execution of a query asyn
chronously using the currently bound parameters.
nsIAuthPromptCallback
netwerk/base/public/nsiauthpromptcallback.idlscriptable interface for callback methods for the asyn
chronous nsiauthprompt2 method.
nsIBrowserHistory
remarks visits are removed syn
chronously, but pages are expired asyn
chronously, off the main thread.
nsICacheService
note: starting in gecko 2.0, cache i/o is handled asyn
chronously.
nsIContentFrameMessageManager
frame scripts can send either syn
chronous or asyn
chronous messages to the chrome process: for details on these messaging apis see the documentation for the nsicontentframemessagemanager's parent classes nsisyncmessagesender and nsimessagesender.
nsIDNSListener
inherits from: nsisupports last changed in gecko 1.7 method overview void onlookupcomplete(in nsicancelable arequest, in nsidnsrecord arecord, in nsresult astatus); methods onlookupcomplete() called when an asyn
chronous host lookup completes.
nsIDNSRequest
inherits from: nsisupports last changed in gecko 1.7 method overview void cancel(); methods cancel() called to cancel a pending asyn
chronous dns request.
nsIDOMMozNetworkStatsManager
constants constant type description wifi long constant for wifi, set to 0 mobile long constant for mobile, set to 1 methods getsamples() asyn
chronously queries network interface statistics.
nsIDOMWindowUtils
loadsheet() syn
chronously loads a style sheet from |sheeturi| and adds it to the list of additional style sheets of the document.
nsIHttpServer
* * @param callback * an asyn
chronous callback used to notify the user when this server is * stopped and all pending requests have been fully served * @throws ns_error_null_pointer * if callback is null * @throws ns_error_unexpected * if this server is not running */ void stop(in nsihttpserverstoppedcallback callback); /** * associates the local file represented by the string file with all requests ...
nsIMessageSender
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsimessagelistenermanager message senders enable clients to send asyn
chronous messages to a single "other side".
nsIMsgFolder
manyheaderstodownload boolean readonly: used to determine if it will take a long time to download all the headers in this folder - so that we can do folder notifications syn
chronously instead of asyn
chronously.
nsIPipe
this example presumes that the pipe is being filled asyn
chronously on some background thread.
nsIProcess2
to create an instance, use: var process2 = components.classes["@mozilla.org/process/util;1"] .createinstance(components.interfaces.nsiprocess2); method overview void runasync([array, size_is(count)] in string args, in unsigned long count, [optional] in nsiobserver observer, [optional] in boolean holdweak); methods runasync() asyn
chronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running.
nsISocketTransport
the status codes appear in near-
chronological order (not in numeric order).
nsISocketTransportService
the notification is asyn
chronous, delivered via the given nsirunnable instance on the socket transport thread.
nsIStyleSheetService
boolean sheetregistered(in nsiuri sheeturi, in unsigned long type); void unregistersheet(in nsiuri sheeturi, in unsigned long type); constants constant value description agent_sheet 0 user_sheet 1 author_sheet 2 methods loadandregistersheet() syn
chronously loads a style sheet from sheeturi and adds it to the list of user or agent style sheets.
nsISupports proxies
xpcom proxies were a technology which allowed code to make asyn
chronous or syn
chronous xpcom calls to a different thread on arbitrary xpcom interfaces.
nsIToolkitProfileService
warning: this service is syn
chronous so it is recommended that you use os.file to find the profile directory via os.constants.path.profiledir.
nsIWebProgress
the nsiwebprogress interface is used to add or remove nsiwebprogresslistener instances to observe the loading of asyn
chronous requests (usually in the context of a dom window).
nsIWebProgressListener
uriloader/base/nsiwebprogresslistener.idlscriptable this interface is implemented by clients wishing to listen in on the progress associated with the loading of asyn
chronous requests in the context of a nsiwebprogress instance as well as any child nsiwebprogress instances.
nsIWebSocketListener
netwerk/protocol/websocket/nsiwebsocketlistener.idlscriptable implement this interface to receive websocket traffic events asyn
chronously after calling nsiwebsocketchannel.asyncopen().
nsIXULTemplateQueryProcessor
if the query processor needs to load the datasource asyn
chronously, it may set the ashoulddelaybuilding returned parameter to true to delay building the template content, and call the builder's rebuild method when the data is available.
nsIXmlRpcClient
the default charset if this function is not called is "utf-8" void setauthentication ( in string encoding ) ; parameters encoding encoding charset to be used asynccall() call remote method methodname asyn
chronously with given arguments.
Performance
the asyn
chronous writes discussed below removes most of the immediate penalty of a commit, so you will not notice the problem as much.
nsIMsgCloudFileProvider
constants the following constants are used for the status codes passed to the onstoprequest functions of the nsirequestobserver's used by the asyn
chronous methods of nsimsgcloudfileprovider.
Gloda examples
this requires two chained asyn
chronous calls: //first take an email address and turn it into an identity object id_q = gloda.newquery(gloda.noun_identity); id_q.kind("email"); id_q.value("test@example.com"); id_coll = id_q.getcollection({ onitemsadded: function _onitemsadded(aitems, acollection) { }, onitemsmodified: function _onitemsmodified(aitems, acollection) { }, ...
Index
this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asyn
chronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting onstart/stoprunningurl notifications when the url starts/stops, etc.
Mailbox
this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asyn
chronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting onstart/stoprunningurl notifications when the url starts/stops, etc.
Mozilla
it syn
chronously returns an nsiapplicationcache object representing the most recent cache version from the most recent cache group containing the entry under the url or a matching namespace.
Scripting plugins - Plugins
the threading model for this api is such that all calls through this api are syn
chronous and calls from a plugin to methods in this api must come from the thread on which the plugin was initiated, and likewise all calls to methods in this api by the browser are guaranteed to come from the same thread.
Streams - Plugins
after this data is copied from the browser's buffer to the plug-in's buffer, the plug-in begins to process the data asyn
chronously.
Waterfall - Firefox Developer Tools
in the screenshot below, we've zoomed in on a js function that's caused a drop in the frame rate: the intensive javascript article shows how the waterfall can highlight responsiveness problems caused by long javascript functions, and how you can use asyn
chronous methods to keep the main thread responsive.
Animation.pending - Web APIs
the read-only animation.pending property of the web animations api indicates whether the animation is currently waiting for an asyn
chronous operation such as initiating playback or pausing a running animation.
Animation.playState - Web APIs
previously, web animations defined a pending value to indicate that some asyn
chronous operation such as initiating playback was yet to complete.
Animation.updatePlaybackRate() - Web APIs
updateplaybackrate() is an asyn
chronous method that sets the speed of an animation after synchronizing with its current playback position, ensuring that the resulting change in speed does not produce a sharp jump.
Animation - Web APIs
animation.pending read only indicates whether the animation is currently waiting for an asyn
chronous operation such as initiating playback or pausing a running animation.
AudioWorkletProcessor.process - Web APIs
the method is called syn
chronously from the audio rendering thread, once for each block of audio (also known as a rendering quantum) being directed through the processor's corresponding audioworkletnode.
BaseAudioContext.createBuffer() - Web APIs
the asyn
chronous method decodeaudiodata() does the same thing — takes compressed audio, say, an mp3 file, and directly gives you back an audiobuffer that you can then set to play via in an audiobuffersourcenode.
Clipboard.read() - Web APIs
note: the asyn
chronous clipboard and permissions apis are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like.
Clipboard API - Web APIs
the clipboard api provides the ability to respond to clipboard commands (cut, copy, and paste) as well as to asyn
chronously read from and write to the system clipboard.
ContentIndex.getAll() - Web APIs
examples the below example shows an asyn
chronous function that retrieves items within the content index and iterates over each entry, building a list for the interface.
Document.currentScript - Web APIs
syntax var curscriptelement = document.currentscript; example this example checks to see if the script is being executed asyn
chronously: if (document.currentscript.async) { console.log("executing asyn
chronously"); } else { console.log("executing syn
chronously"); } view live examples specifications specification status comment html living standardthe definition of 'document.currentscript' in that specification.
Document.write() - Web APIs
note: using document.write() in deferred or asyn
chronous scripts will be ignored and you'll get a message like "a call to document.write() from an asyn
chronously-loaded external script was ignored" in the error console.
Element: DOMMouseScroll event - Web APIs
the dom dommousescroll event is fired asyn
chronously when mouse wheel or similar device is operated and the accumulated scroll amount is over 1 line or 1 page since last event.
Element: mousewheel event - Web APIs
the obsolete and non-standard mousewheel event is fired asyn
chronously at an element to provide updates while a mouse wheel or similar device is operated.
Event - Web APIs
clicking the mouse button or tapping keyboard, or generated by apis to represent the progress of an asyn
chronous task.
FetchEvent - Web APIs
if it finds a match in the cache, it asyn
chronously updates the cache for next time.
Using Fetch - Web APIs
it also provides a global fetch() method that provides an easy, logical way to fetch resources asyn
chronously across the network.
FileError - Web APIs
in the file system api, a fileerror represents error conditions that you might encounter while accessing the file system using the asyn
chronous api.
FileReader - Web APIs
the filereader object lets web applications asyn
chronously read the contents of files (or raw data buffers) stored on the user's computer, using file or blob objects to specify the file or data to read.
FileHandle API - Web APIs
periodically, the results of those operation are asyn
chronously flushed to the device storage area.
Audio() - Web APIs
if a url is specified, the browser begins to asyn
chronously load the media resource before returning the new object.
HTMLImageElement.complete - Web APIs
it's worth noting that due to the image potentially being received asyn
chronously, the value of complete may change while your script is running.
HTMLImageElement - Web APIs
if this value is provided, it must be one of the possible permitted values: sync to decode the image syn
chronously, async to decode it asyn
chronously, or auto to indicate no preference (which is the default).
onMSVideoOptimalLayoutChanged - Web APIs
syntax value description event property object.onmsvideooptimallayoutchanged = handler; attachevent method object.attachevent("onmsvideooptimallayoutchanged", handler) addeventlistener method object.addeventlistener("", handler, usecapture) syn
chronous no bubbles no cancelable no see also msislayoutoptimalforplayback htmlvideoelement microsoft api extensions ...
HTML Drag and Drop API - Web APIs
a key difference between the datatransfer and datatransferitem interfaces is that the former uses the syn
chronous getdata() method to access a drag item's data, but the latter instead uses the asyn
chronous getasstring() method.
IDBCursor - Web APIs
the cursor enables an application to asyn
chronously process all the records in the cursor's range.
IDBDatabase - Web APIs
example in the following code snippet, we open a database asyn
chronously (idbfactory), handle success and error cases, and create a new object store in the case that an upgrade is needed (idbdatabase).
IDBFactory - Web APIs
the idbfactory interface of the indexeddb api lets applications asyn
chronously access the indexed databases.
IDBIndex - Web APIs
idbindex interface of the indexeddb api provides asyn
chronous access to an index in a database.
IDBRequest.error - Web APIs
in addition to the error codes sent to the idbrequest object, asyn
chronous operations can also raise exceptions.
IDBTransaction - Web APIs
the idbtransaction interface of the indexeddb api provides a static, asyn
chronous transaction on a database using event handler attributes.
ImageBitmap - Web APIs
imagebitmap provides an asyn
chronous and resource efficient pathway to prepare textures for rendering in webgl.
IntersectionObserver - Web APIs
the intersectionobserver interface of the intersection observer api provides a way to asyn
chronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.
Keyboard.unlock() - Web APIs
the unlock() method of the keyboard interface unlocks all keys captured by the keyboard.lock() method and returns syn
chronously.
Keyboard - Web APIs
keyboard.unlock() unlocks all keys captured by the lock() method and returns syn
chronously.
LockManager.request() - Web APIs
examples general example the following example shows the basic use of the request() method with an asyn
chronous function as the callback.
MSCandidateWindowHide - Web APIs
general info syn
chronous no bubbles no cancelable no note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event.
MSCandidateWindowShow - Web APIs
general info syn
chronous no bubbles no cancelable no note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event.
MSCandidateWindowUpdate - Web APIs
general info syn
chronous no bubbles no cancelable no note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event.
MediaDevices.getDisplayMedia() - Web APIs
async function startcapture(displaymediaoptions) { let capturestream = null; try { capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } this uses await to asyn
chronously wait for getdisplaymedia() to resolve with a mediastream which contains the display contents as requested by the specified options.
Media Capture and Streams API (Media Stream) - Web APIs
it provides the interfaces and methods for working with the streams and their constituent tracks, the constraints associated with data formats, the success and error callbacks when using the data asyn
chronously, and the events that are fired during the process.
Navigator.clipboard - Web APIs
use of the asyn
chronous clipboard read and write methods requires that the user grant the web site or app permission to access the clipboard.
Navigator - Web APIs
navigator.sendbeacon() used to asyn
chronously transfer a small amount of data using http from the user agent to a web server.
Notification - Web APIs
these notifications' appearance and specific functionality vary across platforms but generally they provide a way to asyn
chronously provide information to the user.
NotificationAction - Web APIs
these buttons' appearance and specific functionality vary across platforms but generally they provide a way to asyn
chronously show actions to the user in a notification.
PerformanceEventTiming - Web APIs
examples the following example shows how to use the api for all events: const observer = new performanceobserver(function(list) { const perfentries = list.getentries().foreach(entry => { // full duration const inputduration = entry.duration; // input delay (before processing event) const inputdelay = entry.processingstart - entry.starttime; // syn
chronous event processing time (between start and end dispatch).
Pointer Lock API - Web APIs
here is an example of using pointerlockelement: if(document.pointerlockelement === canvas || document.mozpointerlockelement === canvas) { console.log('the pointer lock status is now locked'); } else { console.log('the pointer lock status is now unlocked'); } the document.exitpointerlock() method is used to exit pointer lock, and like requestpointerlock, works asyn
chronously using the pointerlockchange and pointerlockerror events, which you'll see more about below.
PushSubscription - Web APIs
pushsubscription.unsubscribe() starts the asyn
chronous process of unsubscribing from the push service, returning a promise that resolves to a boolean when the current subscription is successfully unregistered.
Push API - Web APIs
this lets developers deliver asyn
chronous notifications and updates to users that opt in, resulting in better engagement with timely new content.
RTCDataChannel.bufferedAmount - Web APIs
the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asyn
chronously.
RTCDataChannel.close() - Web APIs
most of the process of closing the connection is handled asyn
chronously; you can detect when the channel has finished closing by watching for a close event on the data channel.
RTCPeerConnection.peerIdentity - Web APIs
example in this example, a function, getidentityassertion(), is created which asyn
chronously waits for the peer's identity to be verified, then returns the identity to the caller.
RTCRtpReceiver.getStats() - Web APIs
the rtcrtpreceiver method getstats() asyn
chronously requests an rtcstatsreport object which provides statistics about incoming traffic on the owning rtcpeerconnection, returning a promise whose fulfillment handler will be called once the results are available.
RTCRtpSender.getStats() - Web APIs
the rtcrtpsender method getstats() asyn
chronously requests an rtcstatsreport object which provides statistics about outgoing traffic on the rtcpeerconnection which owns the sender, returning a promise which is fulfilled when the results are available.
SVGImageElement.decode - Web APIs
the decode() method of the svgimageelement interface initiates asyn
chronous decoding of an image, returning a promise that resolves once the image data is ready for use.
Using the Screen Capture API - Web APIs
starting screen capture: async/await style async function startcapture(displaymediaoptions) { let capturestream = null; try { capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } you can write this code either using an asyn
chronous function and the await operator, as shown above, or using the promise directly, as seen below.
Screen Wake Lock API - Web APIs
the wakelock.request method is promise based and so we can create an asyn
chronous function, which in turn updates the ui to reflect the wake lock is active.
ServiceWorkerGlobalScope - Web APIs
additionally, syn
chronous requests are not allowed from within a service worker — only asyn
chronous requests, like those initiated via the fetch() method, can be used.
Service Worker API - Web APIs
it is designed to be fully async; as a consequence, apis such as syn
chronous xhr and localstorage can't be used inside a service worker.
SourceBuffer.abort() - Web APIs
the mse api is fully asyn
chronous, but this step seems to suggest a syn
chronous (blocking) operation, which doesn't make sense.
SourceBuffer.appendBufferAsync() - Web APIs
the appendbufferasync() method of the sourcebuffer interface begins the process of asyn
chronously appending media segment data from an arraybuffer or arraybufferview object to the sourcebuffer.
SpeechSynthesis.onvoiceschanged - Web APIs
the onvoiceschanged property of the speechsynthesis interface represents an event handler that will run when the list of speechsynthesisvoice objects that would be returned by the speechsynthesis.getvoices() method has changed (when the voiceschanged event fires.) this may occur when speech synthesis is being done on the server-side and the voices list is being determined asyn
chronously, or when client-side voices are installed/uninstalled while a speech synthesis application is running.
Using readable streams - Web APIs
also note that the previous example can be reduced by one step, as response.body is syn
chronous and so doesn't need the promise: // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => { const reader = response.body.getreader(); reading the stream now you’ve got your reader attached, you can read data chunks out of the stream using the readablestreamdefaultreader.read() method.
USBEndpoint - Web APIs
"iso
chronous" - provides unreliable data transfer for payloads that must be delivered periodically.
WakeLock - Web APIs
examples the following asyn
chronous function requests a wakelocksentinel object.
WebGLQuery - Web APIs
the webglquery interface is part of the webgl 2 api and provides ways to asyn
chronously query for information.
The WebSocket API (WebSockets) - Web APIs
jsonrpc-bidirectional: asyn
chronous rpc which, on a single connection, may have functions exported on the server and, and the same time, on the client (client may call server, server may also call client).
Web Speech API - Web APIs
the web speech api has two parts: speechsynthesis (text-to-speech), and speechrecognition (asyn
chronous speech recognition.) web speech concepts and usage the web speech api makes web apps able to handle voice data.
Using Web Workers - Web APIs
this is done syn
chronously; importscripts() does not return until all the scripts have been loaded and executed.
window.postMessage() - Web APIs
as with any asyn
chronously-dispatched script (timeouts, user-generated events), it is not possible for the caller of postmessage to detect when an event handler listening for events sent by postmessage throws an exception.
Window - Web APIs
windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asyn
chronously access capabilities of indexed databases; returns an idbfactory object.
WindowOrWorkerGlobalScope - Web APIs
windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asyn
chronously access capabilities of indexed databases; returns an idbfactory object.
WorkerGlobalScope - Web APIs
windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asyn
chronously access capabilities of indexed databases; returns an idbfactory object.
XMLDocument - Web APIs
4" stroke-width="2px" /><text x="441" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmldocument</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} property also inherits properties from: document xmldocument.async used with xmldocument.load() to indicate an asyn
chronous request.
XMLHttpRequest.responseText - Web APIs
while handling an asyn
chronous request, the value of responsetext always has the current content received from the server, even if it's incomplete because the data has not been completely received yet.
XMLHttpRequest - Web APIs
if the request is asyn
chronous (which is the default), this method returns as soon as the request is sent.
mssitemodejumplistitemremoved - Web APIs
syntax event property object.oncandidatewindowhide = handler; addeventlistener method object.addeventlistener("mssitemodejumplistitemremoved", handler, usecapture) general info syn
chronous no bubbles no cancelable no note this event is raised once for every item that has been removed since the last time mssitemodeshowjumplist was called.
msthumbnailclick - Web APIs
syntax event property object.onmsthumbnailclick = handler; addeventlistener method object.addeventlistener("msthumbnailclick", handler, usecapture) general info syn
chronous no bubbles no cancelable no note the onmsthumbnailclick event is available only to documents that are launched from a pinned site shortcut.
Web APIs
coder textmetrics textrange texttrack texttrackcue texttracklist timeevent timeranges touch touchevent touchlist trackdefault trackdefaultlist trackevent transferable transformstream transitionevent treewalker typeinfo u uievent ulongrange url urlsearchparams urlutilsreadonly usb usbalternateinterface usbconfiguration usbdevice usbendpoint usbintransferresult usbinterface usbiso
chronousintransferpacket usbiso
chronousintransferresult usbiso
chronousouttransferpacket usbiso
chronousouttransferresult usbouttransferresult usvstring userdatahandler userproximityevent v vttcue vttregion validitystate videoconfiguration videoplaybackquality videotrack videotracklist visualviewport w webgl_color_buffer_float webgl_compressed_texture_astc webgl_compressed_texture_at...
CSS: Cascading Style Sheets
previously development of various parts of css specification was done syn
chronously, which allowed versioning of the latest recommendation.
Event reference
this can occur on resize and when the page size changes (while loading for example.) mozbrowserscrollviewchange firefox os browser api-specific sent when asyn
chronous scrolling (i.e.
Event developer guide - Developer guides
events refers both to a design pattern used for the asyn
chronous handling of various incidents which occur in the lifetime of a web page and to the naming, characterization, and use of a large number of incidents of different types.
HTML5 - Developer guides
xmlhttprequest level 2 allows fetching asyn
chronously some parts of the page, allowing it to display dynamic content, varying according to the time and user actions.
Developer guides
events developer guide events refer to two things: a design pattern used for the asyn
chronous handling of various incidents which occur in the lifetime of a web page; and the naming, characterization, and use of a large number of incidents of different types.
Using Feature Policy - HTTP
these features include: layout-inducing animations unoptimized (poorly compressed) images oversized images syn
chronous scripts syn
chronous xmlhttprequest unsized media to avoid breaking existing web content, the default for such policy-controlled features is to allow the functionality to be used by all origins.
Cache-Control - HTTP
stale-while-revalidate=<seconds> indicates the client will accept a stale response, while asyn
chronously checking in the background for a fresh one.
Feature-Policy - HTTP
sync-xhr controls whether the current document is allowed to make syn
chronous xmlhttprequest requests.
202 Accepted - HTTP
202 is non-committal, meaning that there is no way for the http to later send an asyn
chronous response indicating the outcome of processing the request.
Array.prototype.reduceRight() - JavaScript
value = callback(value, t[k], k, t); } } return value; }; } examples sum up all values within an array var sum = [0, 1, 2, 3].reduceright(function(a, b) { return a + b; }); // sum is 6 flatten an array of arrays var flattened = [[0, 1], [2, 3], [4, 5]].reduceright(function(a, b) { return a.concat(b); }, []); // flattened is [4, 5, 2, 3, 0, 1] run a list of asyn
chronous functions with callbacks in series each passing their results to the next const waterfall = (...functions) => (callback, ...args) => functions.reduceright( (composition, fn) => (...results) => fn(composition, ...results), callback )(...args); const randint = max => math.floor(math.random() * max) const add5 = (callback, x) => { settimeout(callback, randint(1000), x + 5); }; con...
Promise.prototype.catch() - JavaScript
function(){ console.log('after a catch the chain is restored'); }, function () { console.log('not fired due to the catch'); }); gotchas when throwing errors // throwing an error will call the catch method most of the time var p1 = new promise(function(resolve, reject) { throw new error('uh-oh!'); }); p1.catch(function(e) { console.error(e); // "uh-oh!" }); // errors thrown inside asyn
chronous functions will act like uncaught errors var p2 = new promise(function(resolve, reject) { settimeout(function() { throw new error('uncaught exception!'); }, 1000); }); p2.catch(function(e) { console.error(e); // this is never called }); // errors thrown after resolve is called will be silenced var p3 = new promise(function(resolve, reject) { resolve(); throw new error('silenced e...
Promise.race() - JavaScript
return value a pending promise that asyn
chronously yields the value of the first promise in the given iterable to fulfill or reject.
function* - JavaScript
generators in javascript -- especially when combined with promises -- are a very powerful tool for asyn
chronous programming as they mitigate -- if not entirely eliminate -- the problems with callbacks, such as callback hell and inversion of control.
JavaScript
asyn
chronous javascript discusses asyn
chronous javascript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server.
Introduction to using XPath in JavaScript - XPath
" city="washington" country="usa"/> <phonenumber>202-456-1111</phonenumber> </person> <person> <name first="tony" last="blair" /> <address street="10 downing street" city="london" country="uk"/> <phonenumber>020 7925 0918</phonenumber> </person> </people> to make the contents of the xml document available within the extension, we create an xmlhttprequest object to load the document syn
chronously, the variable xmldoc will contain the document as an xmldocument object against which we can use the evaluate method javascript used in the extensions xul/js documents.
Basic Example - XSLT: Extensible Stylesheet Language Transformations
l:value-of select="@company" /> </b> </xsl:if> <br /> </xsl:template> <xsl:template match="myns:body"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> the example loads using syn
chronous xmlhttprequest both the .xsl (xslstylesheet) and the .xml (xmldoc) files into memory.
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
figure 1 : instantiating an xsltprocessor var xsltprocessor = new xsltprocessor(); // load the xsl file using syn
chronous (third param is set to false) xmlhttprequest var myxmlhttprequest = new xmlhttprequest(); myxmlhttprequest.open("get", "example.xsl", false); myxmlhttprequest.send(null); var xslref = myxmlhttprequest.responsexml; // finally import the .xsl xsltprocessor.importstylesheet(xslref); for the actual transformation, xsltprocessor requires an xml document, which is used in conjunction ...