Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Move documentation to mixin type
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Dec 19, 2024
1 parent b7871db commit c83c77e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ npm run build
| Path | Description |
|---|---|
| `./src` | Folder containing the source code for your extension |
| `./test` | Folder containing the Jest-based unit-tests (i.e., `*.test.ts`) |
| `./src/__tests__` | Folder containing the Jest-based unit-tests (i.e., `*.test.ts`) |
| `./examples` | Folder containing any examples to demonstrate usage |
| `./global.d.ts` | TypeScript global mixins for PixiJS |


## Publishing
Expand Down
39 changes: 19 additions & 20 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,32 @@ declare global
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace PixiMixins
{
/**
* PixiJS's Rectangle class.
* @class Rectangle
* @see https://pixijs.download/main/docs/maths.Rectangle.html
*/
interface Rectangle
{
/**
* Example of a utility function that can be added to PixiJS's Rectangle class.
* This function expands the rectangle by the given amount. Can also be used
* to contract the Rectangle.
*
* @method expand
* @memberof Rectangle
* @example
* import { Rectangle } from 'pixi.js';
* const rect = new Rectangle(0, 0, 100, 100);
* rect.expand(10);
* @param {number} amount - The amount to expand (if greater than 0) or contract (if less than 0)
* @return {Rectangle} Instance for chaining.
*/
expand(amount: number): this;
}
}
}

/**
* PixiJS's Rectangle class.
* @class Rectangle
* @see https://pixijs.download/main/docs/maths.Rectangle.html
*/

/**
* Example of a utility function that can be added to PixiJS's Rectangle class.
* This function expands the rectangle by the given amount. Can also be used
* to contract the Rectangle.
*
* @method expand
* @memberof Rectangle
* @example
* import { Rectangle } from 'pixi.js';
* const rect = new Rectangle(0, 0, 100, 100);
* rect.expand(10);
* @param {number} amount - The amount to expand (if greater than 0) or contract (if less than 0)
* @return {Rectangle} Instance for chaining.
*/
Rectangle.prototype.expand = function expand(this: Rectangle, amount: number): Rectangle
{
this.x -= amount;
Expand Down

0 comments on commit c83c77e

Please sign in to comment.