npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@joyrobotking/maid

v1.0.4

Published

A convenient way to cleanup useless data and free up memory for your game

Downloads

1

Readme

Maid

Quenty's Maid class with types, and a few additions by me
A simplified way to cleanup garbage in your Roblox game!

New Features

The original Maid logic is pretty neat, but I had a few ideas for improvements.

In my version, you can optionally specify a task priority number when giving the maid a task.
When maid.DoCleaning or maid.Destroy are called, tasks are cleaned starting from highest priority to lowest.

I've also added the ability to cancel a task that has been given to the maid, by calling maid.CancelTask(task_id).

For convenience, I've also added the functions maid.BulkGiveTask and maid.BulkCancelTask that take arrays of parameters.
This should make it a bit easier to cleanup/cancel a bunch of things with a single maid call.

Typescript Usage

let maid = new Maid();

let tid = maid.GiveTask(task);
  // Task is an event connection, function, or Instance. Returns a task id
maid.CancelTask(tid);
  // To cancel a cleaning task, call the CancelTask function
  // with the string id returned when you called GiveTask
 
maid.GiveTask(task, priority);
  // Optionally creates a task with the given priority
  // (higher priority tasks are cleaned before lower priority tasks)

let otherMaid = new Maid();
maid.GiveTask(otherMaid);
  // Other maid class instances can be given as tasks

class ExampleClass {
  constructor() {}

  Destroy() {
    print("Important Cleanup Logic");
  }
}
let ex_class = new ExampleClass();
maid.GiveTask(ex_class);
  // Classes/objects with a member function called "Destroy"
  // and with no return type can also be passed to the maid

maid.GiveTask(() => {
  print("CLEANUP");
});
  // Functions of type () => void can also be passed as tasks to the maid

maid.GiveTask(game.GetService("RunService").Hearbeat.Connect(d => {
  print("RBXConnection Event");
}));
  // RBXScriptConnection instances can also be passed to the maid
  // to be automatically disconnected

let bulk_tids = maid.BulkGiveTask([task1, task2, task3]);
  // You can call BulkGiveTask to automatically give the maid every task item in
  // the provided list. Returns an array of corresponding task ids
maid.BulkCancelTask(bulk_tids);
  // For convenience, you also have a BulkCancelTask function to
  // cancel every task corresponding to an id in the provided list

maid.CancelTask(task_id)
  // Removes a task from Maid. task_id is the string
  // value returned by the GiveTask function

maid.DoCleaning();
  // Alias for Destroy

maid.Destroy();
  // Goes through each task and disconnects events, destroys instances, and
  // calls functions. Returns how many tasks were cleaned