Options
All
  • Public
  • Public/Protected
  • All
Menu

vexflow

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

AccidentalValue

AccidentalValue: -2 | -1 | 0 | 1 | 2

Attributes

Attributes: Record<string, any>

CommitHook

CommitHook: (obj: any, note: StemmableNote, builder: Builder) => void

Type declaration

ContextBuilder

ContextBuilder: typeof getSVGContext | typeof getCanvasContext

FontModule

FontModule: { data: FontData; metrics: FontMetrics }

Type declaration

GroupedResults

GroupedResults: (Result | Result[])[]

KeyValue

KeyValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

Line

Line: { column: number; dblSharpLine: boolean; flatLine: boolean; line: number; numAcc: number; width: number }

Type declaration

  • column: number
  • dblSharpLine: boolean
  • flatLine: boolean
  • line: number
  • numAcc: number
  • width: number

Match

Match: string | Match[] | null

ModifierContextMember

ModifierContextMember: Tickable | Modifier | StaveNote | TabNote

PartialBeamDirection

PartialBeamDirection: typeof BEAM_LEFT | typeof BEAM_RIGHT | typeof BEAM_BOTH

RootValue

RootValue: 0 | 1 | 2 | 3 | 4 | 5 | 6

RuleFunction

RuleFunction: () => Rule

Type declaration

TriggerFunction

TriggerFunction: (state?: { matches: Match[] }) => void

Type declaration

    • (state?: { matches: Match[] }): void
    • Parameters

      • Optional state: { matches: Match[] }

      Returns void

Variables

BEAM_BOTH

BEAM_BOTH: "B" = 'B'

BEAM_LEFT

BEAM_LEFT: "L" = 'L'

BEAM_RIGHT

BEAM_RIGHT: "R" = 'R'

Functions

defined

  • defined<T>(x?: T, code?: string, message?: string): T
  • Check that x is of type T and not undefined. If x is undefined, throw a RuntimeError with the optionally provided error code and message.

    Type parameters

    • T

    Parameters

    • Optional x: T
    • code: string = 'undefined'
    • message: string = ''

    Returns T

drawDot

  • drawDot(ctx: RenderContext, x: number, y: number, color?: string): void
  • Draw a tiny dot marker on the specified context. A great debugging aid.

    Parameters

    • ctx: RenderContext

      context

    • x: number

      dot x coordinate

    • y: number

      dot y coordinate

    • color: string = '#F55'

    Returns void

globalObject

  • globalObject(): typeof globalThis & any
  • VexFlow can be used outside of the browser (e.g., Node) where window may not be defined.

    Returns typeof globalThis & any

Const isAccidental

Const isAnnotation

Const isBarline

  • isBarline(obj: unknown): obj is Barline
  • Parameters

    • obj: unknown

    Returns obj is Barline

isCategory

  • isCategory<T>(obj: any, category: string, checkAncestors?: boolean): obj is T
  • Use instead of instanceof as a more flexible type guard.

    Type parameters

    • T

    Parameters

    • obj: any

      check if this object's CATEGORY matches the provided category.

    • category: string

      a string representing a category of VexFlow objects.

    • checkAncestors: boolean = true

      defaults to true, so we walk up the prototype chain to look for a matching CATEGORY. If false, we do not check the superclass or other ancestors.

    Returns obj is T

    true if obj has a static CATEGORY property that matches category.

Const isDot

  • isDot(obj: unknown): obj is Dot
  • Parameters

    • obj: unknown

    Returns obj is Dot

Const isGraceNote

  • Parameters

    • obj: unknown

    Returns obj is GraceNote

Const isGraceNoteGroup

isHTMLCanvas

  • isHTMLCanvas(element: any): element is HTMLCanvasElement
  • Parameters

    • element: any

    Returns element is HTMLCanvasElement

isHTMLDiv

  • isHTMLDiv(element: any): element is HTMLDivElement
  • Parameters

    • element: any

    Returns element is HTMLDivElement

Const isNote

  • isNote(obj: unknown): obj is Note
  • Parameters

    • obj: unknown

    Returns obj is Note

Const isRenderContext

Const isStaveNote

  • Parameters

    • obj: unknown

    Returns obj is StaveNote

Const isStemmableNote

Const isTabNote

  • isTabNote(obj: unknown): obj is TabNote
  • Parameters

    • obj: unknown

    Returns obj is TabNote

log

  • log(block: string, ...args: any[]): void
  • Default log function sends all arguments to console.

    Parameters

    • block: string
    • Rest ...args: any[]

    Returns void

midLine

  • midLine(a: number, b: number): number
  • Locate the mid point between stave lines. Returns a fractional line if a space.

    Parameters

    • a: number
    • b: number

    Returns number

normalizeAngle

  • normalizeAngle(a: number): number
  • Convert an arbitrary angle in radians to the equivalent one in the range [0, pi).

    Parameters

    • a: number

    Returns number

prefix

  • prefix(text: string): string
  • Used by various classes (e.g., SVGContext) to provide a unique prefix to element names (or other keys in shared namespaces).

    Parameters

    • text: string

    Returns string

warn

  • warn(...args: any[]): void
  • Dump warning to console.

    Parameters

    • Rest ...args: any[]

    Returns void