Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Service implements IService {
/**
* A list of components that this service can embed
*/
private static components: (typeof Report | typeof Tile | typeof Dashboard)[] = [
private static components: (typeof Report | typeof Tile | typeof Dashboard)[] = [
Tile,
Report,
Dashboard
Expand Down Expand Up @@ -170,7 +170,7 @@ export class Service implements IService {
let powerBiElement = <IPowerBiElement>element;
const component = new Create(this, powerBiElement, config);
powerBiElement.powerBiEmbed = component;

this.addOrOverwriteEmbed(component, element);

return component;
Expand Down Expand Up @@ -266,11 +266,11 @@ export class Service implements IService {
/**
* When loading report after create we want to use existing Iframe to optimize load period
*/
if(config.type === "report" && component.config.type === "create") {
if (config.type === "report" && component.config.type === "create") {
const report = new Report(this, element, config, element.powerBiEmbed.iframe);
report.load(<embed.IInternalEmbedConfiguration>config);
element.powerBiEmbed = report;

this.addOrOverwriteEmbed(component, element);

return report;
Expand Down Expand Up @@ -323,7 +323,7 @@ export class Service implements IService {

addOrOverwriteEmbed(component: embed.Embed, element: HTMLElement): void {
// remove embeds over the same div element.
this.embeds = this.embeds.filter(function(embed) {
this.embeds = this.embeds.filter(function (embed) {
return embed.element.id !== element.id;
});

Expand All @@ -350,7 +350,12 @@ export class Service implements IService {
/** Removes the iframe from the element. */
const iframe = element.querySelector('iframe');
if (iframe) {
iframe.remove();
if (iframe.remove !== undefined) {
iframe.remove();
} else {
// workaround for IE: Unhandled rejection TypeError: object doesn't support property or method 'remove'
iframe.parentElement.removeChild(iframe);
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "tslint:recommended",
"rules": {
"max-line-length": false,
"max-line-length": [false],
"member-access": false,
"no-console": false,
"no-console": [false],
"one-line": [
"check-whitespace",
"check-open-brace"
Expand All @@ -12,13 +12,13 @@
"single",
"avoid-escape"
],
"trailing-comma": false,
"trailing-comma": [false],
"whitespace": [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-seperator",
"check-separator",
"check-type"
],
"object-literal-sort-keys": false
Expand Down