Version 3.17.2
Show:

Get.Transaction Class

Defined in: get/js/get.js:723
Module: get

Available since 3.5.0

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.

Constructor

Get.Transaction

()

Defined in get/js/get.js:723

Available since 3.5.0

Item Index

Methods

Methods

abort

(
  • [msg="Aborted."]
)

Defined in get/js/get.js:828

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).

Parameters:

  • [msg="Aborted."] String optional

    Optional message to use in the errors array describing why the transaction was aborted.

execute

(
  • callback
)

Defined in get/js/get.js:851

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).

Parameters:

  • callback Function

    Callback function to execute after all requests in the transaction are complete, or after the transaction is aborted.

purge

()

Defined in get/js/get.js:911

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.

Properties

_lastId

Number protected static

Defined in get/js/get.js:804

Id of the most recent transaction.

_state

String protected

Defined in get/js/get.js:817

Current state of this transaction. One of "new", "executing", or "done".

data

Object

Defined in get/js/get.js:753

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

Object[]

Defined in get/js/get.js:762

Available since 3.5.0

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

Number

Defined in get/js/get.js:772

Available since 3.5.0

Numeric id for this transaction, unique among all transactions within the same YUI sandbox in the current pageview.

nodes

HTMLElement[]

Defined in get/js/get.js:780

HTMLElement nodes (native ones, not YUI Node instances) that have been inserted during the current transaction.

options

Object

Defined in get/js/get.js:787

Available since 3.5.0

Options associated with this transaction.

See Get.options for the full list of available options.

requests

Object

Defined in get/js/get.js:796

Available since 3.5.0

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.