Home Reference Source Test Repository
import Component from 'ics-js/src/Component.js'
public class | source

Component

Direct Subclass:

VALARM, VCALENDAR, VEVENT, VTODO

Base class for components.

Constructor Summary

Public Constructor
public

Create a new component.

Method Summary

Public Methods
public

Add a component to the component.

public

addProp(name: string, value: *, props: Object, skipTransformer: boolean): Property

Add a property to the component.

public

Get a frozen array of the component's components' names.

public

Get a frozen array of the component's components.

public

Get a frozen array of the component's properties' names.

public

Get a frozen array of the component's properties.

public

reset()

Reset the components components and properties to the default empty state.

public

Get a Base64 encoded string representation of the component.

public

toBlob(): Blob

Get a Blob representation of the component.

public

Get a string representation of the component.

public

Validate if all required properties have been added.

Public Constructors

public constructor source

Create a new component.

Public Methods

public addComponent(component: Component): Component source

Add a component to the component.

Params:

NameTypeAttributeDescription
component Component

Configured component to add to the component.

Return:

Component

Provided component.

Throw:

InvalidProvidedComponentError

Provided component type is not in the component's list of valid component types.

public addProp(name: string, value: *, props: Object, skipTransformer: boolean): Property source

Add a property to the component.

Params:

NameTypeAttributeDescription
name string

Name of the property (e.g. DTSTAMP).

value *
  • optional

Value of the property.

props Object
  • optional
  • default: {}

Object of properties for the property. Object keys and values are directly injected.

skipTransformer boolean
  • optional
  • default: false

Explicitly determine if the property's value is transformed.

Return:

Property

Configured property instance.

Throw:

InvalidProvidedPropError

Provided property type is not in the component's list of valid property types.

public componentNames(): string[] source

Get a frozen array of the component's components' names.

Return:

string[]

Frozen array of the component's components' names.

public components(): Component[] source

Get a frozen array of the component's components.

Return:

Component[]

Frozen array of the component's components.

public propNames(): string[] source

Get a frozen array of the component's properties' names.

Return:

string[]

Frozen array of the component's properties' names.

public props(): Property[] source

Get a frozen array of the component's properties.

Return:

Property[]

Frozen array of the component's properties.

public reset() source

Reset the components components and properties to the default empty state.

public toBase64(): String source

Get a Base64 encoded string representation of the component.

Return:

String

Base64 encoded string representation of the component.

public toBlob(): Blob source

Get a Blob representation of the component. Uses MIME_TYPE as the MIME type.

Note: This is a browser-only function unless a Blob polyfill is provided.

Return:

Blob

Blob representation of the component.

Throw:

IncompatiblePlatformError

Blob is undefined. Usually due to running in Node without a polyfill.

public toString(): string source

Get a string representation of the component.

Return:

string

String representation of the component.

public validateRequired(): boolean source

Validate if all required properties have been added.

Return:

boolean

All required properties are present.

Throw:

InvalidComponentError

Required properties are missing.