Skip to content

Commit 7e847e8

Browse files
author
Matt Mazzola
committed
Remove unneeded getConfig since config is already public variable.
1 parent 54bebb1 commit 7e847e8

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

src/embed.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ export abstract class Embed {
8585
this.hpm = hpmFactory(this.iframe.contentWindow, this.service.wpmp);
8686
}
8787

88-
getConfig(): IInternalEmbedConfiguration {
89-
return this.config;
90-
}
91-
9288
/**
9389
* Handler for when the iframe has finished loading the powerbi placeholder page.
9490
* This is used to inject configuration data such as id, access token, and settings etc

src/service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ export class Service {
186186
return component;
187187
}
188188

189+
/**
190+
* Given and element which arleady contains embed, load with new configuration
191+
*/
189192
private embedExisting(element: IPowerBiElement, config: embed.IEmbedConfiguration): embed.Embed {
190193
const component = utils.find(x => x.element === element, this.embeds);
191194
if (!component) {
@@ -249,9 +252,8 @@ export class Service {
249252

250253
handleEvent(event: IEvent<any>): void {
251254
const embed = utils.find(embed => {
252-
const config = embed.getConfig();
253-
return (config.type === event.type
254-
&& config.uniqueId === event.id);
255+
return (embed.config.type === event.type
256+
&& embed.config.uniqueId === event.id);
255257
}, this.embeds);
256258

257259
if(embed) {

test/test.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ describe('service', function () {
283283

284284
// Assert
285285
var report = powerbi.get($reportContainer[0]);
286-
var accessToken = report.getConfig().accessToken;
286+
var accessToken = report.config.accessToken;
287287

288288
expect(accessToken).toEqual(testToken);
289289

@@ -343,7 +343,7 @@ describe('service', function () {
343343
const report = powerbi.embed($reportContainer[0], { id: testReportId });
344344

345345
// Assert
346-
expect(report.getConfig().id).toEqual(testReportId);
346+
expect(report.config.id).toEqual(testReportId);
347347
});
348348

349349
it('should fallback to using id from attribute if not supplied in embed/load configuration', function () {
@@ -357,7 +357,7 @@ describe('service', function () {
357357
const report = powerbi.embed($reportContainer[0]);
358358

359359
// Assert
360-
expect(report.getConfig().id).toEqual(testReportId);
360+
expect(report.config.id).toEqual(testReportId);
361361
});
362362

363363
it('should fallback to using id from embedUrl if not supplied in embed/load configuration or attribute', function () {
@@ -371,7 +371,7 @@ describe('service', function () {
371371
const report = powerbi.embed($reportContainer[0]);
372372

373373
// Assert
374-
expect(report.getConfig().id).toEqual(testReportId);
374+
expect(report.config.id).toEqual(testReportId);
375375
});
376376
});
377377

@@ -2484,7 +2484,7 @@ describe('SDK-to-HPM', function () {
24842484
embedUrl: iframeSrc
24852485
};
24862486
report = <report.Report>powerbi.embed($element[0], embedConfiguration);
2487-
uniqueId = report.getConfig().uniqueId;
2487+
uniqueId = report.config.uniqueId;
24882488

24892489
iframe = <HTMLIFrameElement>$element.find('iframe')[0];
24902490

@@ -3339,7 +3339,7 @@ describe('SDK-to-WPMP', function () {
33393339
wpmpName: 'SDK-to-WPMP report wpmp'
33403340
};
33413341
report = <report.Report>powerbi.embed($element[0], embedConfiguration);
3342-
uniqueId = report.getConfig().uniqueId;
3342+
uniqueId = report.config.uniqueId;
33433343

33443344
iframe = <HTMLIFrameElement>$element.find('iframe')[0];
33453345

@@ -4307,7 +4307,7 @@ describe('SDK-to-MockApp', function () {
43074307
report2.on(testData.eventName, testData.handler2);
43084308

43094309
// Act
4310-
iframeHpm.post(`/reports/${report2.getConfig().uniqueId}/events/${testData.eventName}`, testData.simulatedPageChangeBody)
4310+
iframeHpm.post(`/reports/${report2.config.uniqueId}/events/${testData.eventName}`, testData.simulatedPageChangeBody)
43114311
.then(response => {
43124312
// Assert
43134313
expect(testData.handler2).toHaveBeenCalledWith(testData.simulatedPageChangeBody);

0 commit comments

Comments
 (0)