Skip to content

Commit 2be590e

Browse files
committed
[tools] Add addStartTransactionListener
1 parent 3245df8 commit 2be590e

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/tools/api/core.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,16 @@ export const getStoreCoreApi = (
969969
storeType,
970970
);
971971

972+
// addStartTransactionListener
973+
addProxyListener(
974+
'Start' + TRANSACTION,
975+
transactionListenerType,
976+
REGISTERS_A_LISTENER + ' just before the start of the ' + TRANSACTION_,
977+
EMPTY_STRING,
978+
EMPTY_STRING,
979+
0,
980+
);
981+
972982
// addWillFinishTransactionListener
973983
addProxyListener(
974984
'WillFinish' + TRANSACTION,

test/unit/__snapshots__/tools.test.ts.snap

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,12 @@ export interface S {
834834
*/
835835
finishTransaction(doRollback?: DoRollback): S;
836836

837+
/**
838+
* Registers a listener that will be called just before the start of the
839+
* transaction.
840+
*/
841+
addStartTransactionListener(listener: TransactionListener): Id;
842+
837843
/**
838844
* Registers a listener that will be called just before the end of the
839845
* transaction.
@@ -1234,6 +1240,9 @@ export const createS: typeof createSDecl = () => {
12341240
finishTransaction: (doRollback?: DoRollback): S =>
12351241
fluent(() => store.finishTransaction(doRollback)),
12361242

1243+
addStartTransactionListener: (listener: TransactionListener): Id =>
1244+
store.addStartTransactionListener(proxy(listener)),
1245+
12371246
addWillFinishTransactionListener: (listener: TransactionListener): Id =>
12381247
store.addWillFinishTransactionListener(proxy(listener)),
12391248

@@ -3389,6 +3398,12 @@ export interface S {
33893398
*/
33903399
finishTransaction(doRollback?: DoRollback): S;
33913400

3401+
/**
3402+
* Registers a listener that will be called just before the start of the
3403+
* transaction.
3404+
*/
3405+
addStartTransactionListener(listener: TransactionListener): Id;
3406+
33923407
/**
33933408
* Registers a listener that will be called just before the end of the
33943409
* transaction.
@@ -3569,6 +3584,9 @@ export const createS: typeof createSDecl = () => {
35693584
finishTransaction: (doRollback?: DoRollback): S =>
35703585
fluent(() => store.finishTransaction(doRollback)),
35713586

3587+
addStartTransactionListener: (listener: TransactionListener): Id =>
3588+
store.addStartTransactionListener(proxy(listener)),
3589+
35723590
addWillFinishTransactionListener: (listener: TransactionListener): Id =>
35733591
store.addWillFinishTransactionListener(proxy(listener)),
35743592

@@ -4838,6 +4856,12 @@ export interface S {
48384856
*/
48394857
finishTransaction(doRollback?: DoRollback): S;
48404858

4859+
/**
4860+
* Registers a listener that will be called just before the start of the
4861+
* transaction.
4862+
*/
4863+
addStartTransactionListener(listener: TransactionListener): Id;
4864+
48414865
/**
48424866
* Registers a listener that will be called just before the end of the
48434867
* transaction.
@@ -5141,6 +5165,9 @@ export const createS: typeof createSDecl = () => {
51415165
finishTransaction: (doRollback?: DoRollback): S =>
51425166
fluent(() => store.finishTransaction(doRollback)),
51435167

5168+
addStartTransactionListener: (listener: TransactionListener): Id =>
5169+
store.addStartTransactionListener(proxy(listener)),
5170+
51445171
addWillFinishTransactionListener: (listener: TransactionListener): Id =>
51455172
store.addWillFinishTransactionListener(proxy(listener)),
51465173

@@ -6867,6 +6894,9 @@ startTransaction(): S;
68676894
/** Explicitly finishes a transaction. */
68686895
finishTransaction(doRollback?: DoRollback): S;
68696896

6897+
/** Registers a listener that will be called just before the start of the transaction. */
6898+
addStartTransactionListener(listener: TransactionListener): Id;
6899+
68706900
/** Registers a listener that will be called just before the end of the transaction. */
68716901
addWillFinishTransactionListener(listener: TransactionListener): Id;
68726902

@@ -7106,6 +7136,8 @@ startTransaction: (): S => fluent(() => store.startTransaction()),
71067136

71077137
finishTransaction: (doRollback?: DoRollback): S => fluent(() => store.finishTransaction(doRollback)),
71087138

7139+
addStartTransactionListener: (listener: TransactionListener): Id => store.addStartTransactionListener(proxy(listener)),
7140+
71097141
addWillFinishTransactionListener: (listener: TransactionListener): Id => store.addWillFinishTransactionListener(proxy(listener)),
71107142

71117143
addDidFinishTransactionListener: (listener: TransactionListener): Id => store.addDidFinishTransactionListener(proxy(listener)),
@@ -7843,6 +7875,9 @@ startTransaction(): S;
78437875
/** Explicitly finishes a transaction. */
78447876
finishTransaction(doRollback?: DoRollback): S;
78457877

7878+
/** Registers a listener that will be called just before the start of the transaction. */
7879+
addStartTransactionListener(listener: TransactionListener): Id;
7880+
78467881
/** Registers a listener that will be called just before the end of the transaction. */
78477882
addWillFinishTransactionListener(listener: TransactionListener): Id;
78487883

@@ -7970,6 +8005,8 @@ startTransaction: (): S => fluent(() => store.startTransaction()),
79708005

79718006
finishTransaction: (doRollback?: DoRollback): S => fluent(() => store.finishTransaction(doRollback)),
79728007

8008+
addStartTransactionListener: (listener: TransactionListener): Id => store.addStartTransactionListener(proxy(listener)),
8009+
79738010
addWillFinishTransactionListener: (listener: TransactionListener): Id => store.addWillFinishTransactionListener(proxy(listener)),
79748011

79758012
addDidFinishTransactionListener: (listener: TransactionListener): Id => store.addDidFinishTransactionListener(proxy(listener)),
@@ -8508,6 +8545,9 @@ startTransaction(): S;
85088545
/** Explicitly finishes a transaction. */
85098546
finishTransaction(doRollback?: DoRollback): S;
85108547

8548+
/** Registers a listener that will be called just before the start of the transaction. */
8549+
addStartTransactionListener(listener: TransactionListener): Id;
8550+
85118551
/** Registers a listener that will be called just before the end of the transaction. */
85128552
addWillFinishTransactionListener(listener: TransactionListener): Id;
85138553

@@ -8677,6 +8717,8 @@ startTransaction: (): S => fluent(() => store.startTransaction()),
86778717

86788718
finishTransaction: (doRollback?: DoRollback): S => fluent(() => store.finishTransaction(doRollback)),
86798719

8720+
addStartTransactionListener: (listener: TransactionListener): Id => store.addStartTransactionListener(proxy(listener)),
8721+
86808722
addWillFinishTransactionListener: (listener: TransactionListener): Id => store.addWillFinishTransactionListener(proxy(listener)),
86818723

86828724
addDidFinishTransactionListener: (listener: TransactionListener): Id => store.addDidFinishTransactionListener(proxy(listener)),

0 commit comments

Comments
 (0)