0.2.0 • Published 11 months ago

@isograph/disposable-types v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@isograph/disposable-types

A shared library that exports commonly-used types related to disposable items.

See the @isograph/react-disposable-state library for more information.

What is a disposable item?

A disposable item is anything that is either explicitly created or must be explicitly cleaned up. That is, it is an item with a lifecycle.

A disposable item is safe to use as long as its destructor has not been called.

Code that manages disposable items (such as the useDisposableState hook) should also ensure that each destructor is eventually called, and should not provide access to the underlying item once the destructor has been called.

Disposable items are allowed to have side effects when created or when destroyed.

Example

An example might be a claim to a resource in a shared store.

const [claim, disposeClaim]: ItemCleanupPair<Claim> = store.getClaimToResource({
  id: 4,
});

// Because the claim has not been disposed, this is safe to do:
const data = store.lookup(claim);

disposeClaim();

// Now that we've disposed of the claim, the underlying resource might have been removed from the store, so the following is not safe:
const unsafeData = store.lookup(claim);
0.0.0-main-27c54dfe

11 months ago

0.0.0-main-e3e8bd35

11 months ago

0.0.0-main-2eb325ad

11 months ago

0.0.0-main-f967d0d8

11 months ago

0.0.0-main-a779c3fa

11 months ago

0.0.0-main-27d27904

11 months ago

0.0.0-main-7e518adc

11 months ago

0.0.0-main-5786fd9a

11 months ago

0.0.0-main-33f55790

11 months ago

0.0.0-main-cd6f81ae

11 months ago

0.0.0-main-312396ca

11 months ago

0.0.0-main-81ce1b46

11 months ago

0.0.0-main-2a45cb8e

11 months ago

0.0.0-main-bc3a4c4e

11 months ago

0.0.0-main-2d80240d

11 months ago

0.0.0-main-635653ad

11 months ago

0.0.0-main-6ea7b362

11 months ago

0.0.0-main-a33a3ba5

11 months ago

0.0.0-main-adb0955b

12 months ago

0.0.0-main-ba9f1dc0

12 months ago

0.0.0-main-1ed9144e

12 months ago

0.0.0-main-c08fea92

12 months ago

0.0.0-main-1c9d51fd

12 months ago

0.0.0-main-24a3a309

12 months ago

0.0.0-main-9977b173

12 months ago

0.0.0-main-cebaca69

12 months ago

0.0.0-main-00af1d07

12 months ago

0.0.0-main-eca51643

12 months ago

0.0.0-main-49a3b791

12 months ago

0.0.0-main-86b60cac

12 months ago

0.0.0-main-5da1ab92

12 months ago

0.0.0-main-6bd3135f

12 months ago

0.0.0-main-fa95f207

12 months ago

0.0.0-main-e7d6b095

12 months ago

0.0.0-main-7f0213de

12 months ago

0.0.0-main-a60cb5f4

12 months ago

0.0.0-main-03306d26

12 months ago

0.0.0-main-ed225a2f

12 months ago

0.0.0-main-95d68bdb

12 months ago

0.0.0-main-9624b77b

12 months ago

0.0.0-main-f60a695a

12 months ago

0.0.0-main-3590e7ff

12 months ago

0.0.0-main-3a0c06c0

12 months ago

0.0.0-main-fde72b43

12 months ago

0.0.0-main-359621bd

12 months ago

0.0.0-main-ec963c15

12 months ago

0.0.0-main-deae48c9

12 months ago

0.0.0-main-bcb17610

12 months ago

0.0.0-main-b82d48f7

12 months ago

0.0.0-main-85244746

12 months ago

0.0.0-main-7be74a4a

12 months ago

0.0.0-main-ce58404c

12 months ago

0.0.0-main-c938c1af

12 months ago

0.0.0-main-3f50636d

12 months ago

0.0.0-main-3179ac5f

12 months ago

0.0.0-main-bc897185

12 months ago

0.0.0-main-4693ce16

12 months ago

0.0.0-main-8fa74274

12 months ago

0.2.0

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.4

2 years ago