Pages
    • GETTING STARTED
        • API REFERENCE
                                                                                                                                              • COMMAND LINE
                                                                                                                                                  On this page

                                                                                                                                                          .transaction()

                                                                                                                                                          This method is used to start a transaction on an element for operations that eventually might need to be rolled back. It is a convenient way to use the Play UI's Transaction class.

                                                                                                                                                          Syntax

                                                                                                                                                          let transaction = $(el).transaction(props, readCallback, writeCallback);

                                                                                                                                                          Parameters

                                                                                                                                                          • props: String|Array - A property or list of properties that describes the operation on the element.
                                                                                                                                                          • readCallback: function(el, props) - A function that is called to capture the state of the element using the listed props. See the Transaction class.
                                                                                                                                                          • writeCallback: function(el, record) - A function that is called to re-apply the recorded state of the element as previously derived by the readCallback function. See the Transaction class.

                                                                                                                                                          Return

                                                                                                                                                          Usage

                                                                                                                                                          See the Transaction class.


                                                                                                                                                          Static Usage

                                                                                                                                                          The .transaction() instance method is internally based on the standalone misc/transaction() function which may be used statically.

                                                                                                                                                          Import

                                                                                                                                                          const { transaction } = $.misc;
                                                                                                                                                          import { transaction } from '@webqit/playui-js/src/misc/index.js';

                                                                                                                                                          Syntax

                                                                                                                                                          See the general way to use Play UI's standalone functions