Namespaces

libjass libjass.parser libjass.parts libjass.parts.drawing libjass.renderers libjass.webworker

libjass

Variables

Map

Set to browser's implementation of Map if it has one, else set to libjass.SimpleMap

var result = libjass.Map;
libjass.Map = value;
function(new:Map)
Set

Set to browser's implementation of Set if it has one, else set to libjass.SimpleSet

var result = libjass.Set;
libjass.Set = value;
function(new:Set)
debugMode

Debug mode. When true, libjass logs some debug messages.

var result = libjass.debugMode;
libjass.debugMode = value;
boolean
verboseMode

Verbose debug mode. When true, libjass logs some more debug messages. This setting is independent of debugMode.

var result = libjass.verboseMode;
libjass.verboseMode = value;
boolean

Interfaces

interface Template

A template object. It is a map of string keys and string values.

interface TypedTemplate

A template object with a particular type.

interface TypedTemplateArray extends Array<TypedTemplate>

An array of TypedTemplate objects with the format specifier that was used to parse them.

Classes

class ASS

This class represents an ASS script. It contains the script properties, an array of Styles, and an array of Dialogues.

var ass = new ASS();
dialogues

The dialogues in this script.

var result = ass.dialogues;
!Array.<!libjass.Dialogue>
properties

The properties of this script.

var result = ass.properties;
!libjass.ScriptProperties
styles

The styles in this script.

var result = ass.styles;
!Object.<string, !libjass.Style>
addEvent

Add an event to this ASS script.

ass.addEvent(line);
line
string
The line from the script that contains the new event.
fromString

Creates an ASS object from the raw text of an ASS script.

var result = ASS.fromString(raw, type);
raw
string
The raw text of the script.
type
number=0
The type of the script. One of the libjass.Format constants.
Returns
!libjass.ASS
class Dialogue

This class represents a dialogue in an ASS script.

var dialogue = new Dialogue(template, ass);
template
!Object
The template object that contains the dialogue's properties. It is a map of the string values read from the ASS file.
"Style"
string
The name of the default style of this dialogue
"Start"
string
The start time
"End"
string
The end time
"Layer"
string
The layer number
"Text"
string
The text of this dialogue
ass
ASS
The ASS object to which this dialogue belongs
alignment

The alignment number of this dialogue.

var result = dialogue.alignment;
number
end

The end time of this dialogue.

var result = dialogue.end;
number
id

The unique ID of this dialogue. Auto-generated.

var result = dialogue.id;
number
layer

The layer number of this dialogue.

var result = dialogue.layer;
number
parts

The parts of this dialogue.

var result = dialogue.parts;
!Array.<!libjass.parts.Tag>
start

The start time of this dialogue.

var result = dialogue.start;
number
toString

var result = dialogue.toString();
Returns
string
A simple representation of this dialogue's properties and tags.
_parsePartsString

Parses this dialogue's parts from the raw parts string.

dialogue._parsePartsString();
_toTime

Converts this string into the number of seconds it represents. This string must be in the form of hh:mm:ss.MMM

var result = Dialogue._toTime(str);
str
string
Returns
number
class ScriptProperties

This class represents the properties of an ASS script.

var scriptProperties = new ScriptProperties();
resolutionX

The horizontal script resolution.

var result = scriptProperties.resolutionX;
number
resolutionX

The horizontal script resolution.

scriptProperties.resolutionX = value;
value
number
resolutionY

The vertical script resolution.

var result = scriptProperties.resolutionY;
number
resolutionY

The vertical script resolution.

scriptProperties.resolutionY = value;
value
number
scaleBorderAndShadow

Whether to scale outline widths and shadow depths from script resolution to video resolution or not. If true, widths and depths are scaled.

var result = scriptProperties.scaleBorderAndShadow;
boolean
scaleBorderAndShadow

Whether to scale outline widths and shadow depths from script resolution to video resolution or not. If true, widths and depths are scaled.

scriptProperties.scaleBorderAndShadow = value;
value
boolean
wrappingStyle

The wrap style.

var result = scriptProperties.wrappingStyle;
number
wrappingStyle

The wrap style.

scriptProperties.wrappingStyle = value;
value
number
class Style

This class represents a single global style declaration in an ASS script. The styles can be obtained via the ASS.styles property.

var style = new Style(template);
template
!Object
The template object that contains the style's properties. It is a map of the string values read from the ASS file.
"Name"
string
The name of the style
"Italic"
string
-1 if the style is italicized
"Bold"
string
-1 if the style is bold
"Underline"
string
-1 if the style is underlined
"StrikeOut"
string
-1 if the style is struck-through
"Fontname"
string
The name of the font
"Fontsize"
string
The size of the font
"ScaleX"
string
The horizontal scaling of the font
"ScaleY"
string
The vertical scaling of the font
"Spacing"
string
The letter spacing of the font
"PrimaryColour"
string
The primary color
"OutlineColour"
string
The outline color
"BackColour"
string
The shadow color
"Outline"
string
The outline thickness
"Shadow"
string
The shadow depth
"Alignment"
string
The alignment number
"MarginL"
string
The left margin
"MarginR"
string
The right margin
"MarginV"
string
The vertical margin
alignment

The alignment of dialogues of this style.

var result = style.alignment;
number
bold

Whether this style is bold or not.

var result = style.bold;
boolean
borderStyle

The border style of this style.

var result = style.borderStyle;
number
fontName

The name of this style's font.

var result = style.fontName;
string
fontScaleX

The horizontal scaling of this style's font.

var result = style.fontScaleX;
number
fontScaleY

The vertical scaling of this style's font.

var result = style.fontScaleY;
number
fontSize

The size of this style's font.

var result = style.fontSize;
number
italic

Whether this style is italicized or not.

var result = style.italic;
string
letterSpacing

The letter spacing scaling of this style's font.

var result = style.letterSpacing;
number
marginLeft

The left margin of dialogues of this style.

var result = style.marginLeft;
number
marginRight

The right margin of dialogues of this style.

var result = style.marginRight;
number
marginVertical

The vertical margin of dialogues of this style.

var result = style.marginVertical;
number
name

The name of this style.

var result = style.name;
string
outlineColor

The color of this style's outline.

var result = style.outlineColor;
!libjass.parts.Color
outlineThickness

The thickness of this style's outline.

var result = style.outlineThickness;
number
primaryColor

The color of this style's font.

var result = style.primaryColor;
!libjass.parts.Color
rotationZ

The default Z-rotation of this style.

var result = style.rotationZ;
number
secondaryColor

The alternate color of this style's font, used in karaoke.

var result = style.secondaryColor;
!libjass.parts.Color
shadowColor

The color of this style's shadow.

var result = style.shadowColor;
!libjass.parts.Color
shadowDepth

The depth of this style's shadow.

var result = style.shadowDepth;
number
strikeThrough

Whether this style is struck-through or not.

var result = style.strikeThrough;
boolean
underline

Whether this style is underlined or not.

var result = style.underline;
boolean
class SimpleMap.<K, V>

Map implementation for browsers that don't support it. Only supports keys which are of Number or String type, or which have a property called "id". Keys and values are stored as properties of an object, with property names derived from the key type.

var simpleMap = new SimpleMap();
size

var result = simpleMap.size;
number
clear

simpleMap.clear();
delete

var result = simpleMap.delete(key);
key
K
Returns
boolean
true if the key was present before being deleted, false otherwise
forEach

simpleMap.forEach(callbackfn);
callbackfn
function(V, K, libjass.Map.<K, V>)
A function that is called with each key and value in the map.
get

var result = simpleMap.get(key);
key
K
Returns
V
has

var result = simpleMap.has(key);
key
K
Returns
boolean
set

var result = simpleMap.set(key, value);
key
K
value
V
Returns
libjass.Map.<K, V>
This map
class SimpleSet.<T>

Set implementation for browsers that don't support it. Only supports Number and String elements. Elements are stored as properties of an object, with names derived from their type.

var simpleSet = new SimpleSet();
size

var result = simpleSet.size;
number
add

var result = simpleSet.add(value);
value
T
Returns
libjass.Set.<T>
This set
clear

simpleSet.clear();
forEach

simpleSet.forEach(callbackfn);
callbackfn
function(T, T, libjass.Set.<T>)
A function that is called with each value in the set.
has

var result = simpleSet.has(value);
value
T
Returns
boolean

libjass.parser

Free functions

parse

Parses a given string with the specified rule.

var result = parser.parse(input, rule, customParseTree);
input
string
The string to be parsed.
rule
string
The rule to parse the string with
customParseTree
libjass.parser.ParseNode=null
If provided, this is used as the root of the parse tree instead of a new object.
Returns
*
The value returned depends on the rule used.

Classes

class ParseNode

This class represents a single parse node. It has a start and end position, and an optional value object.

var parseNode = new ParseNode(parent, value);
parent
ParseNode
The parent of this parse node.
value
*=null
If provided, it is assigned as the value of the node.
children

var result = parseNode.children;
!Array.<!ParseNode>
end

The end position of this parse node.

var result = parseNode.end;
number
parent

var result = parseNode.parent;
ParseNode
start

The start position of this parse node.

var result = parseNode.start;
number
value

An optional object associated with this parse node.

var result = parseNode.value;
*
value

An optional object associated with this parse node. If the value is a string, then the end property is updated to be the length of the string.

parseNode.value = value;
value
*
pop

Removes the last child of this node and updates the end position to be end position of the new last child.

parseNode.pop();
_setEnd

Updates the end property of this node and its parent recursively to the root node.

parseNode._setEnd(newEnd);
newEnd
number
class ParserRun

This class represents a single run of the parser.

var parserRun = new ParserRun(input, rule);
input
string
rule
string
result

var result = parserRun.result;
ParseNode
parse_alpha

var result = parserRun.parse_alpha(parent);
parent
!ParseNode
Returns
ParseNode
parse_assScript

var result = parserRun.parse_assScript(parent);
parent
!ParseNode
Returns
ParseNode
parse_assScriptComment

var result = parserRun.parse_assScriptComment(parent);
parent
!ParseNode
Returns
ParseNode
parse_assScriptProperty

var result = parserRun.parse_assScriptProperty(parent);
parent
!ParseNode
Returns
ParseNode
parse_assScriptSection

var result = parserRun.parse_assScriptSection(parent);
parent
!ParseNode
Returns
ParseNode
parse_assScriptSectionHeader

var result = parserRun.parse_assScriptSectionHeader(parent);
parent
!ParseNode
Returns
ParseNode
parse_color

var result = parserRun.parse_color(parent);
parent
!ParseNode
Returns
ParseNode
parse_colorWithAlpha

var result = parserRun.parse_colorWithAlpha(parent);
parent
!ParseNode
Returns
ParseNode
parse_comment

var result = parserRun.parse_comment(parent);
parent
!ParseNode
Returns
ParseNode
parse_decimal

var result = parserRun.parse_decimal(parent);
parent
!ParseNode
Returns
ParseNode
parse_dialogueParts

var result = parserRun.parse_dialogueParts(parent);
parent
!ParseNode
Returns
ParseNode
parse_drawingInstructionCubicBezierCurve

var result = parserRun.parse_drawingInstructionCubicBezierCurve(parent);
parent
!ParseNode
Returns
ParseNode
parse_drawingInstructionLine

var result = parserRun.parse_drawingInstructionLine(parent);
parent
!ParseNode
Returns
ParseNode
parse_drawingInstructionMove

var result = parserRun.parse_drawingInstructionMove(parent);
parent
!ParseNode
Returns
ParseNode
parse_drawingInstructions

var result = parserRun.parse_drawingInstructions(parent);
parent
!ParseNode
Returns
ParseNode
parse_enableDisable

var result = parserRun.parse_enableDisable(parent);
parent
!ParseNode
Returns
ParseNode
parse_enclosedTags

var result = parserRun.parse_enclosedTags(parent);
parent
!ParseNode
Returns
ParseNode
parse_hardspace

var result = parserRun.parse_hardspace(parent);
parent
!ParseNode
Returns
ParseNode
parse_hex

var result = parserRun.parse_hex(parent);
parent
!ParseNode
Returns
ParseNode
parse_newline

var result = parserRun.parse_newline(parent);
parent
!ParseNode
Returns
ParseNode
parse_srtDialogue

var result = parserRun.parse_srtDialogue(parent);
parent
!ParseNode
Returns
ParseNode
parse_srtScript

var result = parserRun.parse_srtScript(parent);
parent
!ParseNode
Returns
ParseNode
parse_srtTime

var result = parserRun.parse_srtTime(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_1a

var result = parserRun.parse_tag_1a(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_1c

var result = parserRun.parse_tag_1c(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_2a

var result = parserRun.parse_tag_2a(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_2c

var result = parserRun.parse_tag_2c(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_3a

var result = parserRun.parse_tag_3a(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_3c

var result = parserRun.parse_tag_3c(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_4a

var result = parserRun.parse_tag_4a(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_4c

var result = parserRun.parse_tag_4c(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_K

var result = parserRun.parse_tag_K(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_a

var result = parserRun.parse_tag_a(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_alpha

var result = parserRun.parse_tag_alpha(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_an

var result = parserRun.parse_tag_an(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_b

var result = parserRun.parse_tag_b(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_be

var result = parserRun.parse_tag_be(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_blur

var result = parserRun.parse_tag_blur(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_bord

var result = parserRun.parse_tag_bord(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_c

var result = parserRun.parse_tag_c(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_clip

var result = parserRun.parse_tag_clip(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fad

var result = parserRun.parse_tag_fad(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fade

var result = parserRun.parse_tag_fade(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fax

var result = parserRun.parse_tag_fax(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fay

var result = parserRun.parse_tag_fay(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fn

var result = parserRun.parse_tag_fn(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fr

var result = parserRun.parse_tag_fr(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_frx

var result = parserRun.parse_tag_frx(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fry

var result = parserRun.parse_tag_fry(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_frz

var result = parserRun.parse_tag_frz(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fs

var result = parserRun.parse_tag_fs(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fscx

var result = parserRun.parse_tag_fscx(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fscy

var result = parserRun.parse_tag_fscy(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fsminus

var result = parserRun.parse_tag_fsminus(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fsp

var result = parserRun.parse_tag_fsp(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_fsplus

var result = parserRun.parse_tag_fsplus(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_i

var result = parserRun.parse_tag_i(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_iclip

var result = parserRun.parse_tag_iclip(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_k

var result = parserRun.parse_tag_k(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_kf

var result = parserRun.parse_tag_kf(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_ko

var result = parserRun.parse_tag_ko(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_move

var result = parserRun.parse_tag_move(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_org

var result = parserRun.parse_tag_org(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_p

var result = parserRun.parse_tag_p(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_pbo

var result = parserRun.parse_tag_pbo(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_pos

var result = parserRun.parse_tag_pos(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_q

var result = parserRun.parse_tag_q(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_r

var result = parserRun.parse_tag_r(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_s

var result = parserRun.parse_tag_s(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_shad

var result = parserRun.parse_tag_shad(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_t

var result = parserRun.parse_tag_t(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_u

var result = parserRun.parse_tag_u(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_xbord

var result = parserRun.parse_tag_xbord(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_xshad

var result = parserRun.parse_tag_xshad(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_ybord

var result = parserRun.parse_tag_ybord(parent);
parent
!ParseNode
Returns
ParseNode
parse_tag_yshad

var result = parserRun.parse_tag_yshad(parent);
parent
!ParseNode
Returns
ParseNode
parse_text

var result = parserRun.parse_text(parent);
parent
!ParseNode
Returns
ParseNode
parse_unsignedDecimal

var result = parserRun.parse_unsignedDecimal(parent);
parent
!ParseNode
Returns
ParseNode
read

var result = parserRun.read(parent, next);
parent
!ParseNode
next
string
Returns
ParseNode
_haveMore

var result = parserRun._haveMore();
Returns
boolean
_parse_tag_clip_or_iclip

var result = parserRun._parse_tag_clip_or_iclip(tagName, parent);
tagName
string
One of "clip" and "iclip"
parent
!ParseNode
Returns
ParseNode
_peek

parserRun._peek(count);
count
number=1

libjass.parts

Interfaces

interface Part

The base interface of the ASS tag classes.

Classes

class Alignment

An alignment tag {\an} or {\a}

var alignment = new Alignment(value);
value
number
{\an###} -> alignment (number)
value

The value of this alignment tag.

var result = alignment.value;
?number
class Alpha

An alpha tag {\alpha}

var alpha = new Alpha(value);
value
?number
{\alpha###} -> alpha (number), {\alpha} -> null
value

The value of this alpha tag.

var result = alpha.value;
?number
class Blur

A blur tag {\be}

var blur = new Blur(value);
value
?number
{\be###} -> strength (number), {\be} -> null
value

The value of this blur tag.

var result = blur.value;
?number
class Bold

A bold tag {\b}

var bold = new Bold(value);
value
*
{\b1} -> true, {\b0} -> false, {\b###} -> weight of the bold (number), {\b} -> null
value

The value of this bold tag.

var result = bold.value;
?boolean|?number
class Border

A border tag {\bord}

var border = new Border(value);
value
?number
{\bord###} -> width (number), {\bord} -> null
value

The value of this border tag.

var result = border.value;
?number
class BorderX

A horizontal border tag {\xbord}

var borderX = new BorderX(value);
value
?number
{\xbord###} -> width (number), {\xbord} -> null
value

The value of this horizontal border tag.

var result = borderX.value;
?number
class BorderY

A vertical border tag {\ybord}

var borderY = new BorderY(value);
value
?number
{\ybord###} -> height (number), {\ybord} -> null
value

The value of this vertical border tag.

var result = borderY.value;
?number
class Color

Represents a CSS color with red, green, blue and alpha components. Instances of this class are immutable.

var color = new Color(red, green, blue, alpha);
red
number
green
number
blue
number
alpha
number=1
alpha

The alpha component of this color as a number between 0 and 1, where 0 means transparent and 1 means opaque.

var result = color.alpha;
number
blue

The blue component of this color as a number between 0 and 255.

var result = color.blue;
number
green

The green component of this color as a number between 0 and 255.

var result = color.green;
number
red

The red component of this color as a number between 0 and 255.

var result = color.red;
number
toString

var result = color.toString();
Returns
string
The CSS representation "rgba(...)" of this color.
withAlpha

var result = color.withAlpha(value);
value
?number
The new alpha. If null, the existing alpha is used.
Returns
!libjass.parts.Color
Returns a new Color instance with the same color but the provided alpha.
class ColorKaraoke

A color karaoke tag {\k}

var colorKaraoke = new ColorKaraoke(duration);
duration
number
{\k###} -> duration (number)
duration

The duration of this color karaoke tag.

var result = colorKaraoke.duration;
number
class Comment

A comment, i.e., any text enclosed in {} that is not understood as an ASS tag.

var comment = new Comment(value);
value
string
The text of this comment
value

The value of this comment.

var result = comment.value;
string
class ComplexFade

A complex fade tag {\fade}

var complexFade = new ComplexFade(a1, a2, a3, t1, t2, t3, t4);
a1
number
a2
number
a3
number
t1
number
t2
number
t3
number
t4
number
a1

The alpha value of this complex fade tag at time t2.

var result = complexFade.a1;
number
a2

The alpha value of this complex fade tag at time t3.

var result = complexFade.a2;
number
a3

The alpha value of this complex fade tag at time t4.

var result = complexFade.a3;
number
t1

The starting time of this complex fade tag.

var result = complexFade.t1;
number
t2

The first intermediate time of this complex fade tag.

var result = complexFade.t2;
number
t3

The second intermediate time of this complex fade tag.

var result = complexFade.t3;
number
t4

The ending time of this complex fade tag.

var result = complexFade.t4;
number
class DrawingBaselineOffset

A drawing mode baseline offset tag {\pbo}

var drawingBaselineOffset = new DrawingBaselineOffset(value);
value
number
value

The value of this drawing mode baseline offset tag.

var result = drawingBaselineOffset.value;
number
class DrawingInstructions

A pseudo-part representing text interpreted as drawing instructions

var drawingInstructions = new DrawingInstructions(instructions);
instructions
!Array.<!libjass.parts.drawing.Instruction>
instructions

The instructions contained in this drawing instructions part.

var result = drawingInstructions.instructions;
!Array.<!libjass.parts.drawing.Instruction>
class DrawingMode

A drawing mode tag {\p}

var drawingMode = new DrawingMode(scale);
scale
number
scale

The scale of this drawing mode tag.

var result = drawingMode.scale;
number
class Fade

A simple fade tag {\fad}

var fade = new Fade(start, end);
start
number
end
number
end

The end time of this fade tag.

var result = fade.end;
number
start

The start time of this fade tag.

var result = fade.start;
number
class FontName

A font name tag {\fn}

var fontName = new FontName(value);
value
?string
{\fn###} -> name (string), {\fn} -> null
value

The value of this font name tag.

var result = fontName.value;
?string
class FontScaleX

A horizontal font scaling tag {\fscx}

var fontScaleX = new FontScaleX(value);
value
?number
{\fscx###} -> scale (number), {\fscx} -> null
value

The value of this horizontal font scaling tag.

var result = fontScaleX.value;
?number
class FontScaleY

A vertical font scaling tag {\fscy}

var fontScaleY = new FontScaleY(value);
value
?number
{\fscy###} -> scale (number), {\fscy} -> null
value

The value of this vertical font scaling tag.

var result = fontScaleY.value;
?number
class FontSize

A font size tag {\fs}

var fontSize = new FontSize(value);
value
?number
{\fs###} -> size (number), {\fs} -> null
value

The value of this font size tag.

var result = fontSize.value;
?number
class FontSizeMinus

A font size decrease tag {\fs-}

var fontSizeMinus = new FontSizeMinus(value);
value
?number
{\fs-###} -> difference (number)
value

The value of this font size decrease tag.

var result = fontSizeMinus.value;
?number
class FontSizePlus

A font size increase tag {\fs+}

var fontSizePlus = new FontSizePlus(value);
value
?number
{\fs+###} -> difference (number)
value

The value of this font size increase tag.

var result = fontSizePlus.value;
?number
class GaussianBlur

A Gaussian blur tag {\blur}

var gaussianBlur = new GaussianBlur(value);
value
?number
{\blur###} -> strength (number), {\blur} -> null
value

The value of this Gaussian blur tag.

var result = gaussianBlur.value;
?number
class Italic

An italic tag {\i}

var italic = new Italic(value);
value
?boolean
{\i1} -> true, {\i0} -> false, {\i} -> null
value

The value of this italic tag.

var result = italic.value;
?boolean
class LetterSpacing

A letter-spacing tag {\fsp}

var letterSpacing = new LetterSpacing(value);
value
?number
{\fsp###} -> spacing (number), {\fsp} -> null
value

The value of this letter-spacing tag.

var result = letterSpacing.value;
?number
class Move

A movement tag {\move}

var move = new Move(x1, y1, x2, y2, t1, t2);
x1
number
y1
number
x2
number
y2
number
t1
number
t2
number
t1

The start time of this move tag.

var result = move.t1;
number
t2

The end time value of this move tag.

var result = move.t2;
number
x1

The starting x value of this move tag.

var result = move.x1;
number
x2

The ending x value of this move tag.

var result = move.x2;
number
y1

The starting y value of this move tag.

var result = move.y1;
number
y2

The ending y value of this move tag.

var result = move.y2;
number
class NewLine

A newline character \N.

var newLine = new NewLine();
class OutlineAlpha

An outline alpha tag {\3a}

var outlineAlpha = new OutlineAlpha(value);
value
?number
{\3a###} -> alpha (number), {\3a} -> null
value

The value of this outline alpha tag.

var result = outlineAlpha.value;
?number
class OutlineColor

An outline color tag {\3c}

var outlineColor = new OutlineColor(value);
value
libjass.parts.Color
{\3c###} -> color (Color), {\3c} -> null
value

The value of this outline color tag.

var result = outlineColor.value;
libjass.parts.Color
class OutlineKaraoke

An outline karaoke tag {\ko}

var outlineKaraoke = new OutlineKaraoke(duration);
duration
number
{\ko###} -> duration (number)
duration

The duration of this outline karaoke tag.

var result = outlineKaraoke.duration;
number
class Position

A position tag {\pos}

var position = new Position(x, y);
x
number
y
number
x

The x value of this position tag.

var result = position.x;
number
y

The y value of this position tag.

var result = position.y;
number
class PrimaryAlpha

A primary alpha tag {\1a}

var primaryAlpha = new PrimaryAlpha(value);
value
?number
{\1a###} -> alpha (number), {\1a} -> null
value

The value of this primary alpha tag.

var result = primaryAlpha.value;
?number
class PrimaryColor

A primary color tag {\c} or {\1c}

var primaryColor = new PrimaryColor(value);
value
libjass.parts.Color
{\1c###} -> color (Color), {\1c} -> null
value

The value of this primary color tag.

var result = primaryColor.value;
libjass.parts.Color
class RectangularClip

A rectangular clip tag {\clip} or {\iclip}

var rectangularClip = new RectangularClip(x1, y1, x2, y2, inside);
x1
number
y1
number
x2
number
y2
number
inside
boolean
inside

Whether this rectangular clip tag clips the region it encloses or the region it excludes.

var result = rectangularClip.inside;
boolean
x1

The X coordinate of the starting position of this rectangular clip tag.

var result = rectangularClip.x1;
number
x2

The X coordinate of the ending position of this rectangular clip tag.

var result = rectangularClip.x2;
number
y1

The Y coordinate of the starting position of this rectangular clip tag.

var result = rectangularClip.y1;
number
y2

The Y coordinate of the ending position of this rectangular clip tag.

var result = rectangularClip.y2;
number
class Reset

A style reset tag {\r}

var reset = new Reset(value);
value
?string
{\r###} -> style name (string), {\r} -> null
value

The value of this style reset tag.

var result = reset.value;
?string
class RotateX

An X-axis rotation tag {\frx}

var rotateX = new RotateX(value);
value
?number
{\frx###} -> angle (number), {\frx} -> null
value

The value of this X-axis rotation tag.

var result = rotateX.value;
?number
class RotateY

A Y-axis rotation tag {\fry}

var rotateY = new RotateY(value);
value
?number
{\fry###} -> angle (number), {\fry} -> null
value

The value of this Y-axis rotation tag.

var result = rotateY.value;
?number
class RotateZ

A Z-axis rotation tag {\fr} or {\frz}

var rotateZ = new RotateZ(value);
value
?number
{\frz###} -> angle (number), {\frz} -> null
value

The value of this Z-axis rotation tag.

var result = rotateZ.value;
?number
class RotationOrigin

A rotation origin tag {\org}

var rotationOrigin = new RotationOrigin(x, y);
x
number
y
number
x

The x value of this rotation origin tag.

var result = rotationOrigin.x;
number
y

The y value of this rotation origin tag.

var result = rotationOrigin.y;
number
class SecondaryAlpha

A secondary alpha tag {\2a}

var secondaryAlpha = new SecondaryAlpha(value);
value
?number
{\2a###} -> alpha (number), {\2a} -> null
value

The value of this secondary alpha tag.

var result = secondaryAlpha.value;
?number
class SecondaryColor

A secondary color tag {\2c}

var secondaryColor = new SecondaryColor(value);
value
libjass.parts.Color
{\2c###} -> color (Color), {\2c} -> null
value

The value of this secondary color tag.

var result = secondaryColor.value;
libjass.parts.Color
class Shadow

A shadow tag {\shad}

var shadow = new Shadow(value);
value
?number
{\shad###} -> depth (number), {\shad} -> null
value

The value of this shadow tag.

var result = shadow.value;
?number
class ShadowAlpha

A shadow alpha tag {\4a}

var shadowAlpha = new ShadowAlpha(value);
value
?number
{\4a###} -> alpha (number), {\4a} -> null
value

The value of this shadow alpha tag.

var result = shadowAlpha.value;
?number
class ShadowColor

A shadow color tag {\4c}

var shadowColor = new ShadowColor(value);
value
libjass.parts.Color
{\4c###} -> color (Color), {\4c} -> null
value

The value of this shadow color tag.

var result = shadowColor.value;
libjass.parts.Color
class ShadowX

A horizontal shadow tag {\xshad}

var shadowX = new ShadowX(value);
value
?number
{\xshad###} -> depth (number), {\xshad} -> null
value

The value of this horizontal shadow tag.

var result = shadowX.value;
?number
class ShadowY

A vertical shadow tag {\yshad}

var shadowY = new ShadowY(value);
value
?number
{\yshad###} -> depth (number), {\yshad} -> null
value

The value of this vertical shadow tag.

var result = shadowY.value;
?number
class SkewX

An X-axis shearing tag {\fax}

var skewX = new SkewX(value);
value
?number
{\fax###} -> angle (number), {\fax} -> null
value

The value of this X-axis shearing tag.

var result = skewX.value;
?number
class SkewY

A Y-axis shearing tag {\fay}

var skewY = new SkewY(value);
value
?number
{\fay###} -> angle (number), {\fay} -> null
value

The value of this Y-axis shearing tag.

var result = skewY.value;
?number
class StrikeThrough

A strike-through tag {\s}

var strikeThrough = new StrikeThrough(value);
value
?boolean
{\s1} -> true, {\s0} -> false, {\s} -> null
value

The value of this strike-through tag.

var result = strikeThrough.value;
?boolean
class SweepingColorKaraoke

A sweeping color karaoke tag {\K} or {\kf}

var sweepingColorKaraoke = new SweepingColorKaraoke(duration);
duration
number
{\kf###} -> duration (number)
duration

The duration of this sweeping color karaoke tag.

var result = sweepingColorKaraoke.duration;
number
class Text

A block of text, i.e., any text not enclosed in {}. Also includes \h.

var text = new Text(value);
value
string
The content of this block of text
value

The value of this text part.

var result = text.value;
string
class Transform

A transform tag {\t}

var transform = new Transform(start, end, accel, tags);
start
number
end
number
accel
number
tags
!Array.<!libjass.parts.Tag>
accel

The acceleration of this transform tag.

var result = transform.accel;
number
end

The ending time of this transform tag.

var result = transform.end;
number
start

The starting time of this transform tag.

var result = transform.start;
number
tags

The tags animated by this transform tag.

var result = transform.tags;
!Array.<!libjass.parts.Tag>
class Underline

An underline tag {\u}

var underline = new Underline(value);
value
?boolean
{\u1} -> true, {\u0} -> false, {\u} -> null
value

The value of this underline tag.

var result = underline.value;
?boolean
class VectorClip

A vector clip tag {\clip} or {\iclip}

var vectorClip = new VectorClip(scale, instructions, inside);
scale
number
instructions
!Array.<!libjass.parts.drawing.Instruction>
inside
boolean
inside

Whether this vector clip tag clips the region it encloses or the region it excludes.

var result = vectorClip.inside;
boolean
instructions

The clip commands of this vector clip tag.

var result = vectorClip.instructions;
string
scale

The scale of this vector clip tag.

var result = vectorClip.scale;
number
class WrappingStyle

A wrapping style tag {\q}

var wrappingStyle = new WrappingStyle(value);
value
number
{\q###} -> style (number)
value

The value of this wrapping style tag.

var result = wrappingStyle.value;
number

libjass.parts.drawing

Interfaces

interface Instruction

The base interface of the drawing instructions.

Classes

class CubicBezierCurveInstruction

An instruction to draw a cubic bezier curve to a particular position, with two given control points.

var cubicBezierCurveInstruction = new CubicBezierCurveInstruction(x1, y1, x2, y2, x3, y3);
x1
number
y1
number
x2
number
y2
number
x3
number
y3
number
x1

The X position of the first control point of this cubic bezier curve instruction.

var result = cubicBezierCurveInstruction.x1;
number
x2

The X position of the second control point of this cubic bezier curve instruction.

var result = cubicBezierCurveInstruction.x2;
number
x3

The ending X position of this cubic bezier curve instruction.

var result = cubicBezierCurveInstruction.x3;
number
y1

The Y position of the first control point of this cubic bezier curve instruction.

var result = cubicBezierCurveInstruction.y1;
number
y2

The Y position of the second control point of this cubic bezier curve instruction.

var result = cubicBezierCurveInstruction.y2;
number
y3

The ending Y position of this cubic bezier curve instruction.

var result = cubicBezierCurveInstruction.y3;
number
class LineInstruction

An instruction to draw a line to a particular position.

var lineInstruction = new LineInstruction(x, y);
x
number
y
number
x

The X position of this line instruction.

var result = lineInstruction.x;
number
y

The Y position of this line instruction.

var result = lineInstruction.y;
number
class MoveInstruction

An instruction to move to a particular position.

var moveInstruction = new MoveInstruction(x, y);
x
number
y
number
x

The X position of this move instruction.

var result = moveInstruction.x;
number
y

The Y position of this move instruction.

var result = moveInstruction.y;
number

libjass.renderers

Classes

class DefaultRenderer extends WebRenderer

A default renderer implementation.

var defaultRenderer = new DefaultRenderer(video, ass, settings);
video
!HTMLVideoElement
ass
!libjass.ASS
settings
!libjass.renderers.RendererSettings
resizeVideo

@deprecated

defaultRenderer.resizeVideo();
class EventSource.<T>

A mixin class that represents an event source.

var eventSource = new EventSource();
_dispatchEvent

eventSource._dispatchEvent(type, args);
type
!T
The type of event to dispatch
args
!Array.<*>
Arguments for the listeners of the event
addEventListener

Add a listener for the given event.

eventSource.addEventListener(type, listener);
type
!T
The type of event to attach the listener for
listener
!Function
The listener
class ManualClock

An implementation of libjass.renderers.Clock that allows user script to manually trigger play, pause and timeUpdate events.

var manualClock = new ManualClock();
currentTime

var result = manualClock.currentTime;
number
enabled

var result = manualClock.enabled;
boolean
disable

Disable the clock.

var result = manualClock.disable();
Returns
boolean
True if the clock is now disabled, false if it was already disabled.
enable

Enable the clock.

var result = manualClock.enable();
Returns
boolean
True if the clock is now enabled, false if it was already enabled.
pause

Trigger a ClockEvent.Pause

manualClock.pause();
play

Trigger a ClockEvent.Play

manualClock.play();
setEnabled

Enable or disable the clock.

var result = manualClock.setEnabled(enabled);
enabled
boolean
If true, the clock is enabled, otherwise it's disabled.
Returns
boolean
True if the clock is now in the given state, false if it was already in that state.
stop

Trigger a ClockEvent.Stop

manualClock.stop();
tick

Trigger a ClockEvent.Tick

manualClock.tick(currentTime);
currentTime
number
toggle

Toggle the clock.

manualClock.toggle();
class NullRenderer

A renderer implementation that doesn't output anything.

var nullRenderer = new NullRenderer(ass, clock, settings);
ass
!libjass.ASS
clock
!libjass.renderers.Clock
settings
!libjass.renderers.RendererSettings
ass

var result = nullRenderer.ass;
!libjass.ASS
clock

var result = nullRenderer.clock;
!libjass.renderers.Clock
enabled

var result = nullRenderer.enabled;
boolean
id

The unique ID of this renderer. Auto-generated.

var result = nullRenderer.id;
number
settings

var result = nullRenderer.settings;
!libjass.renderers.RendererSettings
_onClockPause

Runs when the clock is paused.

nullRenderer._onClockPause();
_onClockPlay

Runs when the clock is enabled, or starts playing, or is resumed from pause.

nullRenderer._onClockPlay();
_onClockStop

Runs when the clock is disabled.

nullRenderer._onClockStop();
_onClockTick

Runs when the clock's current time changed. This might be a result of either regular playback or seeking.

nullRenderer._onClockTick();
disable

Disable the renderer.

var result = nullRenderer.disable();
Returns
boolean
True if the renderer is now disabled, false if it was already disabled.
draw

Draw a dialogue. This is a no-op for this type.

nullRenderer.draw(dialogue);
dialogue
!libjass.Dialogue
enable

Enable the renderer.

var result = nullRenderer.enable();
Returns
boolean
True if the renderer is now enabled, false if it was already enabled.
preRender

Pre-render a dialogue. This is a no-op for this type.

nullRenderer.preRender(dialogue);
dialogue
!libjass.Dialogue
setEnabled

Enable or disable the renderer.

var result = nullRenderer.setEnabled(enabled);
enabled
boolean
If true, the renderer is enabled, otherwise it's disabled.
Returns
boolean
True if the renderer is now in the given state, false if it was already in that state.
toggle

Toggle the renderer.

nullRenderer.toggle();
class RendererSettings

Settings for the renderer.

var rendererSettings = new RendererSettings();
fontMap

A map of font name to one or more URLs of that font. If provided, the fonts in this map are pre-loaded by the WebRenderer when it's created. If you have a <style> or <link> element on the page containing @font-face rules, you can use the RendererSettings.makeFontMapFromStyleElement() convenience method to create a font map.

var result = rendererSettings.fontMap;
rendererSettings.fontMap = value;
!Map.<string, !Array.<string>>
preRenderTime

Subtitles will be pre-rendered for this amount of time (seconds). Defaults to 5.

var result = rendererSettings.preRenderTime;
rendererSettings.preRenderTime = value;
number
preciseOutlines

Subtitle outlines will be rendered in full detail. When false, the value of blur is used to draw less outlines for better performance and (hopefully) similar output. Defaults to false.

var result = rendererSettings.preciseOutlines;
rendererSettings.preciseOutlines = value;
boolean
from

Converts an arbitrary object into a RendererSettings object.

var result = RendererSettings.from(object);
object
!*
Returns
!libjass.renderers.RendererSettings
makeFontMapFromStyleElement

A convenience method to create a font map from a <style> or <link> element that contains @font-face rules.

var result = RendererSettings.makeFontMapFromStyleElement(linkStyle);
linkStyle
!LinkStyle
Returns
!Map.<string, !Array.<string>>
class VideoClock

An implementation of libjass.renderers.Clock that generates play, pause and timeUpdate events according to the state of a <video> element.

var videoClock = new VideoClock(video);
video
!HTMLVideoElement
currentTime

var result = videoClock.currentTime;
number
enabled

var result = videoClock.enabled;
boolean
disable

Disable the clock.

var result = videoClock.disable();
Returns
boolean
True if the clock is now disabled, false if it was already disabled.
enable

Enable the clock.

var result = videoClock.enable();
Returns
boolean
True if the clock is now enabled, false if it was already enabled.
setEnabled

Enable or disable the clock.

var result = videoClock.setEnabled(enabled);
enabled
boolean
If true, the clock is enabled, otherwise it's disabled.
Returns
boolean
True if the clock is now in the given state, false if it was already in that state.
toggle

Toggle the clock.

videoClock.toggle();
class WebRenderer extends NullRenderer

A renderer implementation that draws subtitles to the given <div>

var webRenderer = new WebRenderer(ass, clock, settings, libjassSubsWrapper);
ass
!libjass.ASS
clock
!libjass.renderers.Clock
settings
!libjass.renderers.RendererSettings
libjassSubsWrapper
!HTMLDivElement
Subtitles will be rendered to this <div>
draw

Returns the subtitle div for display. The currentTime is used to shift the animations appropriately, so that at the time the div is inserted into the DOM and the animations begin, they are in sync with the clock time.

webRenderer.draw(dialogue);
dialogue
!libjass.Dialogue
preRender

The magic happens here. The subtitle div is rendered and stored. Call draw() to get a clone of the div to display.

webRenderer.preRender(dialogue);
dialogue
!libjass.Dialogue
resize

Resize the subtitles to the given new dimensions.

webRenderer.resize(width, height);
width
number
height
number
class AnimationCollection

This class represents a collection of animations. Each animation contains one or more keyframes. The collection can then be converted to a CSS3 representation.

var animationCollection = new AnimationCollection(renderer, dialogue);
renderer
!libjass.renderers.NullRenderer
The renderer that this collection is associated with
dialogue
!libjass.Dialogue
The Dialogue that this collection is associated with
animationStyle

This string should be set as the "animation" CSS property of the target element.

var result = animationCollection.animationStyle;
string
cssText

This string contains the animation definitions and should be inserted into a <style> element.

var result = animationCollection.cssText;
string
add

Add an animation to this collection. The given keyframes together make one animation.

animationCollection.add(timingFunction, keyframes);
timingFunction
string
One of the acceptable values for the "animation-timing-function" CSS property
keyframes
Array.<!{time: number, properties: !Object.<string, string>}>
class DrawingStyles

This class represents an ASS drawing - a set of drawing instructions between {\p} tags.

var drawingStyles = new DrawingStyles(outputScaleX, outputScaleY);
outputScaleX
number
outputScaleY
number
baselineOffset

drawingStyles.baselineOffset = value;
value
number
scale

drawingStyles.scale = value;
value
number
toSVG

Converts this drawing to an <svg> element.

var result = drawingStyles.toSVG(drawingInstructions, fillColor);
drawingInstructions
!libjass.parts.DrawingInstructions
fillColor
!libjass.parts.Color
Returns
!SVGSVGElement
class Keyframe

This class represents a single keyframe. It has a list of CSS properties (names and values) associated with a point in time. Multiple keyframes make up an animation.

var keyframe = new Keyframe(time, properties);
time
number
properties
!Object.<string, string>
properties

var result = keyframe.properties;
!Object.<string, string>
time

var result = keyframe.time;
number
class SpanStyles

This class represents the style attribute of a span. As a Dialogue's div is rendered, individual parts are added to span's, and this class is used to maintain the style attribute of those.

var spanStyles = new SpanStyles(renderer, dialogue, scaleX, scaleY, settings, fontSizeElement, svgDefsElement);
renderer
!libjass.renderers.NullRenderer
The renderer that this set of styles is associated with
dialogue
!libjass.Dialogue
The Dialogue that this set of styles is associated with
scaleX
number
The horizontal scaling of the subtitles
scaleY
number
The vertical scaling of the subtitles
settings
!libjass.renderers.RendererSettings
The renderer settings
fontSizeElement
!HTMLDivElement
A <div> element to measure font sizes with
svgDefsElement
!SVGDefsElement
An SVG <defs> element to append filter definitions to
blur

Sets the blur property. null defaults it to 0.

spanStyles.blur = value;
value
?number
bold

Sets the bold property. null defaults it to the default style's value.

spanStyles.bold = value;
value
(?number|?boolean)
fontName

Sets the font name property. null defaults it to the default style's value.

spanStyles.fontName = value;
value
?string
fontScaleX

Sets the horizontal font scaling property. null defaults it to the default style's value.

spanStyles.fontScaleX = value;
value
?number
fontScaleY

Sets the vertical font scaling property. null defaults it to the default style's value.

spanStyles.fontScaleY = value;
value
?number
fontSize

Sets the font size property. null defaults it to the default style's value.

spanStyles.fontSize = value;
value
?number
gaussianBlur

Sets the Gaussian blur property. null defaults it to 0.

spanStyles.gaussianBlur = value;
value
?number
italic

Sets the italic property. null defaults it to the default style's value.

spanStyles.italic = value;
value
?boolean
letterSpacing

Sets the letter spacing property. null defaults it to the default style's value.

spanStyles.letterSpacing = value;
value
?number
outlineAlpha

Sets the outline alpha property.

spanStyles.outlineAlpha = value;
value
?number
outlineColor

Sets the outline color property. null defaults it to the default style's value.

spanStyles.outlineColor = value;
value
libjass.parts.Color
outlineHeight

Sets the outline height property. null defaults it to the style's original outline height value.

spanStyles.outlineHeight = value;
value
?number
outlineWidth

Sets the outline width property. null defaults it to the style's original outline width value.

spanStyles.outlineWidth = value;
value
?number
primaryAlpha

Gets the primary alpha property.

var result = spanStyles.primaryAlpha;
?number
primaryAlpha

Sets the primary alpha property.

spanStyles.primaryAlpha = value;
value
?number
primaryColor

Gets the primary color property.

var result = spanStyles.primaryColor;
!libjass.parts.Color
primaryColor

Sets the primary color property. null defaults it to the default style's value.

spanStyles.primaryColor = value;
value
libjass.parts.Color
rotationX

Sets the X-axis rotation property.

spanStyles.rotationX = value;
value
?number
rotationY

Sets the Y-axis rotation property.

spanStyles.rotationY = value;
value
?number
rotationZ

Sets the Z-axis rotation property.

spanStyles.rotationZ = value;
value
?number
secondaryAlpha

Sets the secondary alpha property.

spanStyles.secondaryAlpha = value;
value
?number
secondaryColor

Sets the secondary color property. null defaults it to the default style's value.

spanStyles.secondaryColor = value;
value
libjass.parts.Color
shadowAlpha

Sets the shadow alpha property.

spanStyles.shadowAlpha = value;
value
?number
shadowColor

Sets the shadow color property. null defaults it to the default style's value.

spanStyles.shadowColor = value;
value
libjass.parts.Color
shadowDepthX

Sets the outline width property. null defaults it to the style's original shadow depth X value.

spanStyles.shadowDepthX = value;
value
?number
shadowDepthY

Sets the shadow height property. null defaults it to the style's original shadow depth Y value.

spanStyles.shadowDepthY = value;
value
?number
skewX

Sets the X-axis skew property.

spanStyles.skewX = value;
value
?number
skewY

Sets the Y-axis skew property.

spanStyles.skewY = value;
value
?number
strikeThrough

Sets the strike-through property. null defaults it to the default style's value.

spanStyles.strikeThrough = value;
value
?boolean
underline

Sets the underline property. null defaults it to the default style's value.

spanStyles.underline = value;
value
?boolean
reset

Resets the styles to the defaults provided by the argument.

spanStyles.reset(newStyle);
newStyle
libjass.Style
The new defaults to reset the style to. If null, the styles are reset to the default style of the Dialogue.
setStylesOnSpan

Sets the style attribute on the given span element.

var result = spanStyles.setStylesOnSpan(span);
span
!HTMLSpanElement
Returns
!HTMLSpanElement
The resulting <span> with the CSS styles applied. This may be a wrapper around the input <span> if the styles were applied using SVG filters.

libjass.webworker

Free functions

_registerWorkerCommand

Registers a handler for the given worker command.

webworker._registerWorkerCommand(command, handler);
command
number
The command that this handler will handle. Valid values are the values of libjass.webworker.WorkerCommands
handler
function(*, function(*, *))
The handler. A function of the form (parameters: *, response: function(error: *, result: *): void): void
createWorker

Create a new web worker.

var result = webworker.createWorker();
Returns
!libjass.webworker.WorkerChannel
A communication channel to the new web worker.

Interfaces

interface WorkerChannel

Represents a communication channel between the host and the web worker. An instance of this class is created by calling libjass.webworker.setup()

interface WorkerCommandHandler

The signature of a handler registered to handle a particular WorkerCommand.

interface WorkerPromise

A promise returned by libjass.webworker.WorkerChannel.request()

interface WorkerPromiseCallback

The signature of a callback called by WorkerPromise when it is resolved.

interface WorkerResultCallback

The signature of a callback called by a WorkerCommandHandler to report its result back to the caller.

Classes

class WorkerChannelImpl

Internal implementation of libjass.webworker.WorkerChannel

var workerChannelImpl = new WorkerChannelImpl(comm);
comm
!*
The other side of the channel. When created by the host, this is the web worker. When created by the web worker, this is its global object.