# Class: CanvasBaseItem<T2> (/jsdoc/pixi-vn/index/classes/CanvasBaseItem)



Defined in: [src/canvas/classes/CanvasBaseItem.ts:31](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/classes/CanvasBaseItem.ts#L31)

This class is used to create a canvas element to add into a Pixi Application.
You can use [()](/jsdoc/pixi-vn/index/interfaces/CanvasManagerInterface#add) to add this element into the application.
This class should be implemented and the memory method should be overridden.
You must use the [canvasComponentDecorator](/jsdoc/pixi-vn/index/namespaces/RegisteredCanvasComponents) to register the canvas in the game.
In Ren'Py is a displayable.

Example [#example]

```typescript
const CANVAS_EXAMPLE_ID = "CanvasExample";

\@canvasComponentDecorator({
    name: CANVAS_EXAMPLE_ID,
})
export class CanvasExample extends Container implements CanvasBaseItem<Memory> {
    get memory(): Memory {
        return {
            pixivnId: CANVAS_EXAMPLE_ID,
            // ... other properties
        }
    }
    async setMemory(value: Memory) {
        // ... set other properties
    }
}
```

Extended by [#extended-by]

* [`CanvasBaseInterface`](/jsdoc/pixi-vn/index/interfaces/CanvasBaseInterface)

Type Parameters [#type-parameters]

T2 [#t2]

`T2` *extends* [`CanvasBaseItemMemory`](/jsdoc/pixi-vn/index/interfaces/CanvasBaseItemMemory)

Constructors [#constructors]

Constructor [#constructor]

\> **new CanvasBaseItem**\<`T2`>(...`_options`): `CanvasBaseItem`\<`T2`>

Defined in: [src/canvas/classes/CanvasBaseItem.ts:32](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/classes/CanvasBaseItem.ts#L32)

Parameters [#parameters]

\_options [#_options]

...`any`

Returns [#returns]

`CanvasBaseItem`\<`T2`>

Properties [#properties]

pixivnId [#pixivnid]

\> **pixivnId**: `string` = `"canvas_element_id_not_set"`

Defined in: [src/canvas/classes/CanvasBaseItem.ts:56](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/classes/CanvasBaseItem.ts#L56)

Get the id of the canvas element. This variable is used in the system to get the canvas element by id

Accessors [#accessors]

memory [#memory]

Get Signature [#get-signature]

\> **get** **memory**(): `T2`

Defined in: [src/canvas/classes/CanvasBaseItem.ts:37](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/classes/CanvasBaseItem.ts#L37)

This method return the memory of the canvas element.

Throws [#throws]

when the method is not overridden in the subclass.

Returns [#returns-1]

`T2`

Methods [#methods]

setMemory() [#setmemory]

\> **setMemory**(`_value`): `void` | `Promise`\<`void`>

Defined in: [src/canvas/classes/CanvasBaseItem.ts:47](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/canvas/classes/CanvasBaseItem.ts#L47)

This method set the memory of the canvas element.

Parameters [#parameters-1]

\_value [#_value]

`T2`

Returns [#returns-2]

`void` | `Promise`\<`void`>

Throws [#throws-1]

when the method is not overridden in the subclass.
