Skip to content

Commit

Permalink
Merge pull request #37 from subzey/feat-readonly
Browse files Browse the repository at this point in the history
Readonly<stuff>
  • Loading branch information
timocov authored Jun 6, 2019
2 parents 4ea7d17 + fe35119 commit f4c031d
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/api/chart-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class ChartApi implements IChartApi, DataUpdatesConsumer<SeriesType> {
this._chartWidget.applyOptions(options);
}

public options(): ChartOptions {
public options(): Readonly<ChartOptions> {
return this._chartWidget.options();
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/ichart-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export interface IChartApi {
* Returns currently applied options
* @return - full set of currently applied options, including defaults
*/
options(): ChartOptions;
options(): Readonly<ChartOptions>;

/**
* Removes branding text from the chart.
Expand Down
2 changes: 1 addition & 1 deletion src/api/iprice-scale-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export interface IPriceScaleApi {
* Returns currently applied options of the price scale
* @return full set of currently applied options, including defaults
*/
options(): PriceScaleOptions;
options(): Readonly<PriceScaleOptions>;
}
2 changes: 1 addition & 1 deletion src/api/itime-scale-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ export interface ITimeScaleApi {
* Returns current options
* @return - currently applied options
*/
options(): TimeScaleOptions;
options(): Readonly<TimeScaleOptions>;
}
2 changes: 1 addition & 1 deletion src/api/price-scale-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class PriceScaleApi implements IPriceScaleApi, IDestroyable {
this._chartModel.applyOptions({ priceScale: options });
}

public options(): PriceScaleOptions {
public options(): Readonly<PriceScaleOptions> {
return this._priceScale().options();
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/time-scale-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class TimeScaleApi implements ITimeScaleApi, IDestroyable {
this._timeScale().applyOptions(options);
}

public options(): TimeScaleOptions {
public options(): Readonly<TimeScaleOptions> {
return clone(this._timeScale().options());
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/chart-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class ChartWidget implements IDestroyable {
return this._model;
}

public options(): ChartOptions {
public options(): Readonly<ChartOptions> {
return this._options;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/price-axis-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class PriceAxisWidget implements IDestroyable {
return makeFont(this.fontSize(), this._options.fontFamily);
}

public rendererOptions(): PriceAxisViewRendererOptions {
public rendererOptions(): Readonly<PriceAxisViewRendererOptions> {
const options = this._rendererOptionsProvider.options();

const isColorChanged = this._color !== options.color;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/time-axis-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export class TimeAxisWidget implements MouseEventHandlers, IDestroyable {
return makeFont(this._fontSize(), this._options.fontFamily, 'bold');
}

private _getRendererOptions(): TimeAxisViewRendererOptions {
private _getRendererOptions(): Readonly<TimeAxisViewRendererOptions> {
if (this._rendererOptions === null) {
this._rendererOptions = {
borderSize: Constants.BorderSize,
Expand Down
6 changes: 3 additions & 3 deletions src/model/chart-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class ChartModel implements IDestroyable {
this._hoveredSource = source;
}

public options(): ChartOptions {
public options(): Readonly<ChartOptions> {
return this._options;
}

Expand Down Expand Up @@ -162,7 +162,7 @@ export class ChartModel implements IDestroyable {
return this._timeScale;
}

public panes(): Pane[] {
public panes(): ReadonlyArray<Pane> {
return this._panes;
}

Expand Down Expand Up @@ -492,7 +492,7 @@ export class ChartModel implements IDestroyable {
return this._rendererOptionsProvider;
}

public priceAxisRendererOptions(): PriceAxisViewRendererOptions {
public priceAxisRendererOptions(): Readonly<PriceAxisViewRendererOptions> {
return this._rendererOptionsProvider.options();
}

Expand Down
4 changes: 2 additions & 2 deletions src/model/crosshair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class Crosshair extends DataSource {
return this._index;
}

public options(): CrosshairOptions {
public options(): Readonly<CrosshairOptions> {
return this._options;
}

Expand Down Expand Up @@ -207,7 +207,7 @@ export class Crosshair extends DataSource {
this.clearOriginCoord();
}

public paneViews(pane: Pane): IPaneView[] {
public paneViews(pane: Pane): ReadonlyArray<IPaneView> {
return this._pane !== null ? [this._paneView, this._markersPaneView] : [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/price-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class PriceScale {
this._markBuilder = new PriceTickMarkBuilder(this, 100, this._coordinateToLogical.bind(this), this._logicalToCoordinate.bind(this));
}

public options(): PriceScaleOptions {
public options(): Readonly<PriceScaleOptions> {
return this._options;
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/time-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class TimeScale {
this._updateDateTimeFormatter();
}

public options(): TimeScaleOptions {
public options(): Readonly<TimeScaleOptions> {
return this._options;
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/watermark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Watermark extends DataSource {
return [this._paneView];
}

public options(): WatermarkOptions {
public options(): Readonly<WatermarkOptions> {
return this._options;
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/price-axis-renderer-options-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class PriceAxisRendererOptionsProvider {
this._chartModel = chartModel;
}

public options(): PriceAxisViewRendererOptions {
public options(): Readonly<PriceAxisViewRendererOptions> {
const rendererOptions = this._rendererOptions;

const currentFontSize = this._fontSize();
Expand Down

0 comments on commit f4c031d

Please sign in to comment.