Home Reference Source Repository
import Decoration from 'minimap/lib/decoration.js'
public class | source

Decoration

The Decoration class represents a decoration in the Minimap.

It has the same API than the Decoration class of a text editor.

Static Method Summary

Static Public Methods
public static

isType(decorationProperties: Object, type: string): boolean

Returns true if the passed-in decoration properties matches the specified type.

Constructor Summary

Public Constructor
public

constructor(marker: Marker, minimap: Minimap, properties: Object)

Creates a new decoration.

Method Summary

Public Methods
public

Destroy this marker.

public

An id unique across all Decoration objects.

public

getMarker(): Marker

Returns the marker associated with this Decoration.

public

Returns the Decoration's properties.

public

Returns whether this decoration is destroyed or not.

public

Check if this decoration is of type type.

public

onDidChangeProperties(callback: function(change: Object): void): Disposable

Registers an event listener to the did-change-properties event.

public

onDidDestroy(callback: function(): void): Disposable

Registers an event listener to the did-destroy event.

public

setProperties(newProperties: Object)

Update the marker with new properties.

Static Public Methods

public static isType(decorationProperties: Object, type: string): boolean source

Returns true if the passed-in decoration properties matches the specified type.

Params:

NameTypeAttributeDescription
decorationProperties Object

the decoration properties to match

type string

the decoration type to match

Return:

boolean

whether the decoration properties match the type

Public Constructors

public constructor(marker: Marker, minimap: Minimap, properties: Object) source

Creates a new decoration.

Params:

NameTypeAttributeDescription
marker Marker

the target marker for the decoration

minimap Minimap

the Minimap where the decoration will be displayed

properties Object

the decoration's properties

Public Methods

public destroy() source

Destroy this marker.

If you own the marker, you should use Marker#destroy which will destroy this decoration.

public getId(): number source

An id unique across all Decoration objects.

Return:

number

the decoration id

public getMarker(): Marker source

Returns the marker associated with this Decoration.

Return:

Marker

the decoration's marker

public getProperties(): Object source

Returns the Decoration's properties.

Return:

Object

the decoration's properties

public isDestroyed(): boolean source

Returns whether this decoration is destroyed or not.

Return:

boolean

whether this decoration is destroyed or not

public isType(type: string | Array): boolean source

Check if this decoration is of type type.

Params:

NameTypeAttributeDescription
type string | Array

a type like 'line-number', 'line', etc. type can also be an Array of Strings, where it will return true if the decoration's type matches any in the array.

Return:

boolean

whether this decoration match the passed-in type

public onDidChangeProperties(callback: function(change: Object): void): Disposable source

Registers an event listener to the did-change-properties event.

This event is triggered when the decoration update method is called.

Params:

NameTypeAttributeDescription
callback function(change: Object): void

a function to call when the event is triggered

Return:

Disposable

a disposable to stop listening to the event

public onDidDestroy(callback: function(): void): Disposable source

Registers an event listener to the did-destroy event.

Params:

NameTypeAttributeDescription
callback function(): void

a function to call when the event is triggered

Return:

Disposable

a disposable to stop listening to the event

public setProperties(newProperties: Object) source

Update the marker with new properties. Allows you to change the decoration's class.

Params:

NameTypeAttributeDescription
newProperties Object

the new properties for the decoration