This package has been deprecated

Author message:

Discontinue support for @musicca/structs due to overheads. Read more: https://github.com/musiccajs/musicca/issues/14

@musicca/structs
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published
Logo
GitHub npm GitHub issues

About 📛

This package is a collection of structures for Musicca.

Installation 💾

npm install @musicca/structs
yarn add @musicca/structs
pnpm add @musicca/structs

Guide 🖋

Creating custom queue

First, you need to create a new queue class with your custom implementation

import { Queue, Media } from 'musicca';

export default class CustomQueue extends Queue {
  public list: Media[] = [];

  // Always put options at the 3rd parameter
  constructor(manager, id, options) { ... }

  // All custom methods are awaitable by default
  public all() { ... }
  public add<T extends Media | Media[] = Media>(media: T, position?: number) { ... }
  public get(position: number) { ... }
  public remove(position: number) { ... }
  public clear() { ... }
  public indexOf(media: Media) { ... }
}

Now, you can just plug it in to musicca

const client = new Musicca<CustomQueue>({
  plugins: { ... },
  structs: {
    queue: CustomQueue
  }
});

Links 🔗

/@musicca/structs/

    Package Sidebar

    Install

    npm i @musicca/structs

    Weekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    7.27 kB

    Total Files

    9

    Last publish

    Collaborators

    • edqe