Repository navigation
Expand file tree
/
Copy pathembed.d.ts
More file actions
133 lines (133 loc) · 4.01 KB
/
Copy pathembed.d.ts
File metadata and controls
133 lines (133 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*! powerbi-client v2.0.0-beta.6 | (c) 2016 Microsoft Corporation MIT */
import * as service from './service';
import * as models from 'powerbi-models';
import * as hpm from 'http-post-message';
declare global {
interface Document {
mozCancelFullScreen: Function;
msExitFullscreen: Function;
}
interface HTMLIFrameElement {
mozRequestFullScreen: Function;
msRequestFullscreen: Function;
}
}
export interface IEmbedConfiguration {
type?: string;
id?: string;
uniqueId?: string;
embedUrl?: string;
accessToken?: string;
settings?: models.ISettings;
}
export interface IInternalEmbedConfiguration extends models.ILoadConfiguration {
uniqueId: string;
type: string;
embedUrl: string;
}
export interface IInternalEventHandler<T> {
test(event: service.IEvent<T>): boolean;
handle(event: service.IEvent<T>): void;
}
export declare abstract class Embed {
static allowedEvents: string[];
static accessTokenAttribute: string;
static embedUrlAttribute: string;
static nameAttribute: string;
static typeAttribute: string;
static type: string;
private static defaultSettings;
allowedEvents: any[];
eventHandlers: IInternalEventHandler<any>[];
hpm: hpm.HttpPostMessage;
service: service.Service;
element: HTMLElement;
iframe: HTMLIFrameElement;
config: IInternalEmbedConfiguration;
/**
* Note: there is circular reference between embeds and service
* The service has list of all embeds on the host page, and each embed has reference to the service that created it.
*/
constructor(service: service.Service, hpmFactory: service.IHpmFactory, element: HTMLElement, config: IEmbedConfiguration);
/**
* Sends load configuration data.
*
* ```javascript
* report.load({
* type: 'report',
* id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
* accessToken: 'eyJ0eXA ... TaE2rTSbmg',
* settings: {
* navContentPaneEnabled: false
* },
* pageName: "DefaultPage",
* filte: "DefaultReportFilter"
* })
* .catch(error => { ... });
* ```
*/
load(config: models.ILoadConfiguration): Promise<void>;
/**
* Given an event object, find all event handlers for the event, and invoke them with the event value.
*/
handleEvent(event: service.IEvent<any>): void;
/**
* Removes event handler(s) from list of handlers.
*
* If reference to existing handle function is specified remove specific handler.
* If handler is not specified, remove all handlers for the event name specified.
*
* ```javascript
* report.off('pageChanged')
*
* or
*
* const logHandler = function (event) {
* console.log(event);
* };
*
* report.off('pageChanged', logHandler);
* ```
*/
off<T>(eventName: string, handler?: service.IEventHandler<T>): void;
/**
* Adds event handler for specific event.
*
* ```javascript
* report.on('pageChanged', (event) => {
* console.log('PageChanged: ', event.page.name);
* });
* ```
*/
on<T>(eventName: string, handler: service.IEventHandler<T>): void;
/**
* Get access token from first available location: config, attribute, global.
*/
private getAccessToken(globalAccessToken);
/**
* Get embed url from first available location: options, attribute.
*/
private getEmbedUrl();
/**
* Get unique id from first available location: options, attribute.
* If neither is provided generate unique string.
*/
private getUniqueId();
/**
* Get report id from first available location: options, attribute.
*/
abstract getId(): string;
/**
* Request the browser to make the component's iframe fullscreen.
*/
fullscreen(): void;
/**
* Exit fullscreen.
*/
exitFullscreen(): void;
/**
* Return true if iframe is fullscreen,
* otherwise return false
*/
private isFullscreen(iframe);
}