# @types/jcanvas

> TypeScript definitions for jcanvas

Latest version **15.2.8** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/jcanvas
pnpm add @types/jcanvas
yarn add @types/jcanvas
bun add @types/jcanvas
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 15.2.8 |
| Published | 2023-11-07 |
| First published | 2016-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51430 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/jcanvas
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jcanvas
- npm.io page: https://npm.io/package/@types/jcanvas

## Dependencies (1)

- [@types/jquery](https://npm.io/package/@types/jquery.md) *

## Recent versions

- 15.2.8 (latest) — 2023-11-07
- 15.2.5 (ts3.6) — 2021-07-09
- 15.2.3 (ts3.0) — 2020-05-15
- 15.2.2 (ts2.3) — 2017-06-15
- 15.2.1 (ts2.0) — 2016-10-11
- 15.2.7 — 2023-10-18
- 15.2.6 — 2023-09-15
- 15.2.4 — 2021-07-08

## README

# Installation
> `npm install --save @types/jcanvas`

# Summary
This package contains type definitions for jcanvas (https://github.com/caleb531/jcanvas).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jcanvas.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jcanvas/index.d.ts)
````ts
/// <reference types="jquery"/>

interface JCanvasRect {
    x: number;
    y: number;
    width: number;
    height: number;
}

interface JCanvasSliceDef {
    fillStyle: string;
    x: number;
    y: number;
    /**
     * Radius in pixels
     */
    radius: number;
    /**
     * Start angle in degrees from north
     */
    start: number;
    /**
     * End angle in degrees from north
     */
    end: number;
    /**
     * Distance between slices as a fraction of the radius
     */
    spread?: number | undefined;

    layer?: boolean | undefined;
    name?: string | undefined;
    groups?: string[] | undefined;
}

interface JCanvasTextDef {
    fillStyle: string;
    strokeStyle: string;
    strokeWidth: number;
    x: number;
    y: number;
    fontSize: number;
    fontFamily: string;
    text: string;
}

interface JQuery {
    /**
     * This clearCanvas() clears all or any part of the canvas
     * If nothing is passed, the entire canvas is cleared.
     * Clearing a section works in the same way as drawing a rectangle,
     * with the rectangle being drawn from its center (by default).
     */
    clearCanvas(rect?: JCanvasRect): void;

    /**
     * A slice in jCanvas is, essentially, a slice of a circle (similar to a pizza slice).
     * You can draw a slice using the drawSlice() method. The size of a slice is determined by its start, end, and radius properties.
     * The position of a slice is determined by its x and y properties. These coordinates lie at the tip of the slice.
     */
    drawSlice(def: JCanvasSliceDef): void;

    /**
     * To draw text on the canvas, use the drawText() method.
     * The resulting text on the canvas is determined by the value of the text property, as well as any of the following font properties:
     * fontStyle
     * fontSize
     * fontFamily
     */
    drawText(def: JCanvasTextDef): void;
}

// note this declare module is necessary to tell TypeScript not to interpret the whole file as one module;
// the JQuery interface below should extend the existing jquery module interface
declare module "jcanvas" {
    function jcanvas(jquery: JQueryStatic, window: Window): void;
    export = jcanvas;
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
 * Dependencies: [@types/jquery](https://npmjs.com/package/@types/jquery)

# Credits
These definitions were written by [Rogier Schouten](https://github.com/rogierschouten).

---
_Source: https://npm.io/package/@types/jcanvas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
