Skip to content

osyrisrblx/rbxts-bin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rbxts/bin

A super simple alternative to Maid.

Bin.Item

type Bin.Item =
	(() => unknown) // any function
	| RBXScriptConnection // an event connection
	| { destroy(): void } // object with destroy() or Destroy()
	| { Destroy(): void }; // i.e. Roblox Instances!

Bin.add

public add<T extends Bin.Item>(item: T): T;

Adds the item into the Bin, will return the item you passed in.

The returned value is useful for instances:

const part = this.bin.add(new Instance("Part"));
this.bin.add(part.Touched.Connect(() => print("Touched!")));

// later..

// both `part` and the connection are cleaned up!
this.bin.destroy();

Bin.destroy

public destroy(): void;

Destroys all items currently in the Bin:

  • Functions will be called
  • RBXScriptConnections will be disconnected
  • Objects will be .destroy()-ed

Bin.isEmpty

public isEmpty(): boolean;

Checks whether the Bin is empty.

About

A super simple alternative to Maid. 🗑️

Resources

License

Stars

Watchers

Forks

Releases

No releases published