Represents a Get transaction, which may contain requests for one or more JS or CSS files.
This class should not be instantiated manually. Instances will be created and
returned as needed by Y.Get's css()
, js()
, and load()
methods.
Get.Transaction
abort
[msg="Aborted."]
Aborts this transaction.
This will cause the transaction's onFailure
callback to be called and
will prevent any new script and link nodes from being added to the document,
but any resources that have already been requested will continue loading
(there's no safe way to prevent this, unfortunately).
[msg="Aborted."]
String
optional
Optional message to use in the errors
array describing why the transaction was aborted.
execute
callback
Begins execting the transaction.
There's usually no reason to call this manually, since Get will call it automatically when other pending transactions have finished. If you really want to execute your transaction before Get does, you can, but be aware that this transaction's scripts may end up executing before the scripts in other pending transactions.
If the transaction is already executing, the specified callback (if any) will be queued and called after execution finishes. If the transaction has already finished, the callback will be called immediately (the transaction will not be executed again).
callback
Function
Callback function to execute after all requests in the transaction are complete, or after the transaction is aborted.
purge
Manually purges any <script>
or <link>
nodes this transaction has
created.
Be careful when purging a transaction that contains CSS requests, since
removing <link>
nodes will also remove any styles they applied.
data
Arbitrary data object associated with this transaction.
This object comes from the options passed to Get.css()
, Get.js()
, or
Get.load()
, and will be undefined
if no data object was specified.
errors
Array of errors that have occurred during this transaction, if any. Each error
object has the following properties:
errors.error
: Error message.
errors.request
: Request object related to the error.
id
Numeric id for this transaction, unique among all transactions within the same YUI sandbox in the current pageview.
nodes
HTMLElement nodes (native ones, not YUI Node instances) that have been inserted during the current transaction.
options
Options associated with this transaction.
See Get.options
for the full list of available options.
requests
Request objects contained in this transaction. Each request object represents one CSS or JS URL that will be (or has been) requested and loaded into the page.