npm.io
1.0.4 • Published 2 years ago

@rbxts/transact

Licence
MIT
Version
1.0.4
Deps
2
Size
10 kB
Vulns
0
Weekly
0

Transaction

Transaction will allow you to conduct secure transactions using Transact, Rollback methods.

Example

A code snippet showing how to set up and use Transaction.

class TestEntity implements ITransactEntity {
	public Init() {
		print("Init");
	}
	
	public async Transact() {
		print("Manipulating the data");
		print("Data saving");
	}

	public async Rollback() {
		print("Here you can roll back the data to its original state");
	}

	public End() {
		print("End");
	}
}

const transaction = new Transaction([new TestEntity(), new TestEntity()]);
const transact = transaction.Transact().expect();
print(transact.StatusCodes);

Keywords