Skip to content

Commit b5d6bb9

Browse files
author
Matt Mazzola
committed
Update init function to allow supplying a common configuration to all the components it attempts to embed and return them.
1 parent c2ba347 commit b5d6bb9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ export class PowerBi {
8383
* and automatically attempts to embed a powerbi component based on information from the attributes.
8484
* Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created.
8585
*/
86-
init(container?: HTMLElement): void {
86+
init(container?: HTMLElement, config: embed.IEmbedConfiguration = undefined): embed.Embed[] {
8787
container = (container && container instanceof HTMLElement) ? container : document.body;
8888

8989
const elements = Array.prototype.slice.call(container.querySelectorAll(`[${embed.Embed.embedUrlAttribute}]`));
90-
elements.forEach(element => this.embed(element));
90+
return elements.map(element => this.embed(element, config));
9191
}
9292

9393
/**

0 commit comments

Comments
 (0)