@adobe/exc-app 0.2.39 → 0.2.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/page.ts CHANGED
@@ -248,10 +248,38 @@ export interface PageApiProperties {
248
248
  unloadPromptMessage: string;
249
249
  }
250
250
 
251
+ export interface Callback {(value?: any): void}
252
+
251
253
  /**
252
254
  * Defines page-level APIs available to solutions.
253
255
  */
254
256
  export interface PageApi extends PageApiProperties {
257
+ /**
258
+ * A function that listens and handles the afterPrint event.
259
+ *
260
+ * ```typescript
261
+ * ***Example:***
262
+ * page.afterPrintHandler = function () {
263
+ * // Revert temporary CSS changes
264
+ * };
265
+ * ````
266
+ * @param callback The function that results in printing.
267
+ */
268
+ afterPrintHandler(callback: Callback): void;
269
+
270
+ /**
271
+ * A function that listens and handles the beforePrint event.
272
+ *
273
+ * ```typescript
274
+ * ***Example:***
275
+ * page.beforePrintHandler = function () {
276
+ * // Temporary CSS changes, like unsetting height
277
+ * };
278
+ * ````
279
+ * @param callback The function that results in printing.
280
+ */
281
+ beforePrintHandler(callback: Callback): void;
282
+
255
283
  /**
256
284
  * Sometimes applications will need to block navigation away from the current page. The most common use case
257
285
  * for this is when a user has unsaved changes that would be lost on navigation.
@@ -392,6 +420,22 @@ export interface PageApi extends PageApiProperties {
392
420
  */
393
421
  openInNewTab(path: string, newApp?: boolean): void;
394
422
 
423
+ /**
424
+ * A function to control printing. The callback function should call `window.print()`
425
+ * at some point. It's important that the callback not be an arrow function if you
426
+ * want the `window` object to be the iframe contents. Feel free to adjust your
427
+ * CSS or UI before `window.print()` and reverse those changes afterwards.
428
+ *
429
+ * ```typescript
430
+ * ***Example:***
431
+ * page.print = function () {
432
+ * window.print();
433
+ * };
434
+ * ````
435
+ * @param callback The function that results in printing.
436
+ */
437
+ print(callback: Callback): void;
438
+
395
439
  /**
396
440
  * Set the list of selectors presently being used by modalAutoDetect. If set to an empty
397
441
  * array, the default selectors used by runtime will be used instead. To stop observing changes
@@ -425,7 +469,9 @@ export interface PageApi extends PageApiProperties {
425
469
  }
426
470
 
427
471
  const page = connect('page', [
472
+ ['afterPrintHandler'],
428
473
  ['appContainer'],
474
+ ['beforePrintHandler'],
429
475
  ['blockNavigation', true],
430
476
  ['clipboardWrite', true],
431
477
  ['done', true],
@@ -438,6 +484,7 @@ const page = connect('page', [
438
484
  ['notFound', true],
439
485
  ['openInNewTab', true],
440
486
  ['preventDefaultCombos'],
487
+ ['print', true],
441
488
  ['shellRedirect', true],
442
489
  ['setModalQuerySelectors'],
443
490
  ['spinner'],
@@ -1,161 +0,0 @@
1
- **[@adobe/exc-app](../README.md)**
2
-
3
- > [Globals](../README.md) / [](../modules/reflection-936.md) / [](../modules/reflection-936.reflection-270.md) / Modules
4
-
5
- # Interface: Modules
6
-
7
- ## Hierarchy
8
-
9
- * **Modules**
10
-
11
- ## Index
12
-
13
- ### Properties
14
-
15
- * [appApi](reflection-936.reflection-270.modules.md#appapi)
16
- * [capabilityApi](reflection-936.reflection-270.modules.md#capabilityapi)
17
- * [default](reflection-936.reflection-270.modules.md#default)
18
- * [helpCenter](reflection-936.reflection-270.modules.md#helpcenter)
19
- * [internal](reflection-936.reflection-270.modules.md#internal)
20
- * [metrics](reflection-936.reflection-270.modules.md#metrics)
21
- * [network](reflection-936.reflection-270.modules.md#network)
22
- * [nps](reflection-936.reflection-270.modules.md#nps)
23
- * [orgSwitcher](reflection-936.reflection-270.modules.md#orgswitcher)
24
- * [page](reflection-936.reflection-270.modules.md#page)
25
- * [permissions](reflection-936.reflection-270.modules.md#permissions)
26
- * [pulse](reflection-936.reflection-270.modules.md#pulse)
27
- * [runtime](reflection-936.reflection-270.modules.md#runtime)
28
- * [session](reflection-936.reflection-270.modules.md#session)
29
- * [settings](reflection-936.reflection-270.modules.md#settings)
30
- * [shell](reflection-936.reflection-270.modules.md#shell)
31
- * [sidebar](reflection-936.reflection-270.modules.md#sidebar)
32
- * [sidenav](reflection-936.reflection-270.modules.md#sidenav)
33
- * [topbar](reflection-936.reflection-270.modules.md#topbar)
34
- * [user](reflection-936.reflection-270.modules.md#user)
35
- * [userProfile](reflection-936.reflection-270.modules.md#userprofile)
36
-
37
- ## Properties
38
-
39
- ### appApi
40
-
41
- • `Readonly` **appApi**: () => [AppApi](appapi.appapi-1.md)
42
-
43
- ___
44
-
45
- ### capabilityApi
46
-
47
- • `Readonly` **capabilityApi**: () => [CapabilityApi](capabilityapi.capabilityapi-1.md)
48
-
49
- ___
50
-
51
- ### default
52
-
53
- • `Readonly` **default**: (options?: any) => [Runtime](reflection-936.reflection-270.runtime.md)
54
-
55
- ___
56
-
57
- ### helpCenter
58
-
59
- • `Readonly` **helpCenter**: [HelpCenterApi](helpcenter.helpcenterapi.md)
60
-
61
- ___
62
-
63
- ### internal
64
-
65
- • `Readonly` **internal**: InternalApi
66
-
67
- ___
68
-
69
- ### metrics
70
-
71
- • `Readonly` **metrics**: [MetricsApi](metrics.metricsapi.md)
72
-
73
- ___
74
-
75
- ### network
76
-
77
- • `Readonly` **network**: [NetworkApi](network.networkapi.md)
78
-
79
- ___
80
-
81
- ### nps
82
-
83
- • `Readonly` **nps**: [Nps](nps.nps-1.md)
84
-
85
- ___
86
-
87
- ### orgSwitcher
88
-
89
- • `Readonly` **orgSwitcher**: OrgSwitcherApi
90
-
91
- ___
92
-
93
- ### page
94
-
95
- • `Readonly` **page**: [PageApi](page.pageapi.md)
96
-
97
- ___
98
-
99
- ### permissions
100
-
101
- • `Readonly` **permissions**: () => [PermissionsApi](permissions.permissionsapi.md)
102
-
103
- ___
104
-
105
- ### pulse
106
-
107
- • `Readonly` **pulse**: () => [PulseApi](pulse.pulseapi.md)
108
-
109
- ___
110
-
111
- ### runtime
112
-
113
- • **runtime**: [Runtime](reflection-936.reflection-270.runtime.md)
114
-
115
- ___
116
-
117
- ### session
118
-
119
- • `Readonly` **session**: () => [SessionApi](session.sessionapi.md)
120
-
121
- ___
122
-
123
- ### settings
124
-
125
- • `Readonly` **settings**: () => [SettingsApi](settings.settingsapi.md)
126
-
127
- ___
128
-
129
- ### shell
130
-
131
- • `Readonly` **shell**: () => [ShellApi](shell.shellapi.md)
132
-
133
- ___
134
-
135
- ### sidebar
136
-
137
- • `Readonly` **sidebar**: SidebarApi
138
-
139
- ___
140
-
141
- ### sidenav
142
-
143
- • `Readonly` **sidenav**: () => SidenavApi
144
-
145
- ___
146
-
147
- ### topbar
148
-
149
- • `Readonly` **topbar**: [TopbarApi](topbar.topbarapi.md)
150
-
151
- ___
152
-
153
- ### user
154
-
155
- • `Readonly` **user**: () => [UserApi](user.userapi.md)
156
-
157
- ___
158
-
159
- ### userProfile
160
-
161
- • `Readonly` **userProfile**: [UserProfileApi](userprofile.userprofileapi.md)
@@ -1,102 +0,0 @@
1
- **[@adobe/exc-app](../README.md)**
2
-
3
- > [Globals](../README.md) / [](../modules/reflection-936.md) / [](../modules/reflection-936.reflection-270.md) / Runtime
4
-
5
- # Interface: Runtime\<T>
6
-
7
- Defines the runtime object providing all unified-shell APIs for solution authors.
8
-
9
- ## Type parameters
10
-
11
- Name | Default |
12
- ------ | ------ |
13
- `T` | Record\\<string, any> |
14
-
15
- ## Hierarchy
16
-
17
- * EventEmitter
18
-
19
- ↳ **Runtime**
20
-
21
- ## Index
22
-
23
- ### EventEmitter Methods
24
-
25
- * [emit](reflection-936.reflection-270.runtime.md#emit)
26
- * [off](reflection-936.reflection-270.runtime.md#off)
27
- * [on](reflection-936.reflection-270.runtime.md#on)
28
-
29
- ## EventEmitter Methods
30
-
31
- ### emit
32
-
33
- ▸ **emit**\<K>(`type`: K, `event?`: T[K]): void
34
-
35
- *Inherited from void*
36
-
37
- Invoke all handlers for the given type.
38
-
39
- #### Type parameters:
40
-
41
- Name | Type |
42
- ------ | ------ |
43
- `K` | keyof T |
44
-
45
- #### Parameters:
46
-
47
- Name | Type | Description |
48
- ------ | ------ | ------ |
49
- `type` | K | The event type to invoke. |
50
- `event?` | T[K] | Any value (object is recommended and powerful), passed to each handler. |
51
-
52
- **Returns:** void
53
-
54
- ___
55
-
56
- ### off
57
-
58
- ▸ **off**\<K>(`type`: K, `handler`: (event?: T[K]) => void): void
59
-
60
- *Inherited from void*
61
-
62
- Remove an event handler for the given type.
63
-
64
- #### Type parameters:
65
-
66
- Name | Type |
67
- ------ | ------ |
68
- `K` | keyof T |
69
-
70
- #### Parameters:
71
-
72
- Name | Type | Description |
73
- ------ | ------ | ------ |
74
- `type` | K | Type of event to unregister `handler` from. |
75
- `handler` | (event?: T[K]) => void | Handler function to remove. |
76
-
77
- **Returns:** void
78
-
79
- ___
80
-
81
- ### on
82
-
83
- ▸ **on**\<K>(`type`: K, `handler`: (event?: T[K]) => void): void
84
-
85
- *Inherited from void*
86
-
87
- Register an event handler for the given type.
88
-
89
- #### Type parameters:
90
-
91
- Name | Type |
92
- ------ | ------ |
93
- `K` | keyof T |
94
-
95
- #### Parameters:
96
-
97
- Name | Type | Description |
98
- ------ | ------ | ------ |
99
- `type` | K | Type of event to listen for. |
100
- `handler` | (event?: T[K]) => void | Function to call in response to given event. |
101
-
102
- **Returns:** void
@@ -1,11 +0,0 @@
1
- **[@adobe/exc-app](../README.md)**
2
-
3
- > [Globals](../README.md) /
4
-
5
- # Module:
6
-
7
- ## Index
8
-
9
- ### Modules
10
-
11
- * [](reflection-936.reflection-270.md)
@@ -1,74 +0,0 @@
1
- **[@adobe/exc-app](../README.md)**
2
-
3
- > [Globals](../README.md) / [](reflection-936.md) /
4
-
5
- # Module:
6
-
7
- ## Index
8
-
9
- ### Interfaces
10
-
11
- * [Modules](../interfaces/reflection-936.reflection-270.modules.md)
12
- * [Runtime](../interfaces/reflection-936.reflection-270.runtime.md)
13
-
14
- ### Functions
15
-
16
- * [init](reflection-936.reflection-270.md#init)
17
- * [runtime](reflection-936.reflection-270.md#runtime)
18
-
19
- ## Functions
20
-
21
- ### init
22
-
23
- ▸ **init**(`bootstrap`: (runtime: [Runtime](../interfaces/reflection-936.reflection-270.runtime.md)) => void): void
24
-
25
- Initializes a solution web application by invoking the bootstrap callback
26
- once the runtime is ready.
27
- 1. if the module is already defined, start to bootstrap
28
- 2. otherwise define the global callback that will be called when runtime is ready.
29
-
30
- ***Example:***
31
-
32
- ```typescript
33
- import React from 'react';
34
- import ReactDOM from 'react-dom';
35
- import runtime, {init} from '@adobe/exc-app';
36
-
37
- init(() => {
38
- ReactDOM.render(<MainComponent runtime={runtime()} />, document.querySelector('#main'));
39
- });
40
- ```
41
-
42
- #### Parameters:
43
-
44
- Name | Type | Description |
45
- ------ | ------ | ------ |
46
- `bootstrap` | (runtime: [Runtime](../interfaces/reflection-936.reflection-270.runtime.md)) => void | Callback used to bootstrap a solution. The runtime object is passed in as a parameter to this callback. |
47
-
48
- **Returns:** void
49
-
50
- ___
51
-
52
- ### runtime
53
-
54
- ▸ **runtime**(): [Runtime](../interfaces/reflection-936.reflection-270.runtime.md)
55
-
56
- Get the runtime object which contains all unified-shell APIs.
57
-
58
- ***Example:***
59
-
60
- ```typescript
61
- import React from 'react';
62
- import ReactDOM from 'react-dom';
63
- import excApp from '@adobe/exc-app';
64
-
65
- export class MyComponent extends React.Component {
66
- constructor(props) {
67
- this.runtime = excApp();
68
- }
69
- }
70
- ```
71
-
72
- **Returns:** [Runtime](../interfaces/reflection-936.reflection-270.runtime.md)
73
-
74
- The runtime object.