@genesislcap/foundation-events 14.408.0 → 14.409.0
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/README.md +6 -96
- package/package.json +10 -10
- package/docs/api/foundation-events.constructabletypedeventemitter.md +0 -16
- package/docs/api/foundation-events.createinputemitter.md +0 -30
- package/docs/api/foundation-events.createselectemitter.md +0 -30
- package/docs/api/foundation-events.customevent.md +0 -51
- package/docs/api/foundation-events.customeventmap.md +0 -16
- package/docs/api/foundation-events.defaulteventemitterdi.emit.md +0 -50
- package/docs/api/foundation-events.defaulteventemitterdi.md +0 -47
- package/docs/api/foundation-events.emitargs.md +0 -14
- package/docs/api/foundation-events.emitoptions.md +0 -14
- package/docs/api/foundation-events.emitorigin.md +0 -12
- package/docs/api/foundation-events.emitreturn.md +0 -12
- package/docs/api/foundation-events.emitter.md +0 -54
- package/docs/api/foundation-events.eventdetailmap.md +0 -12
- package/docs/api/foundation-events.eventemitter.md +0 -448
- package/docs/api/foundation-events.eventemitterdi.emit.md +0 -50
- package/docs/api/foundation-events.eventemitterdi.md +0 -66
- package/docs/api/foundation-events.eventemittertarget.md +0 -16
- package/docs/api/foundation-events.getbaseemitargs.md +0 -51
- package/docs/api/foundation-events.isemitoptions.md +0 -51
- package/docs/api/foundation-events.keysmatching.md +0 -14
- package/docs/api/foundation-events.logger.md +0 -12
- package/docs/api/foundation-events.md +0 -327
- package/docs/api/foundation-events.registeremitter.md +0 -17
- package/docs/api/foundation-events.targetchecked.md +0 -28
- package/docs/api/foundation-events.targetfirstselectedvalue.md +0 -12
- package/docs/api/foundation-events.targetvalue.md +0 -12
- package/docs/api/foundation-events.typedemitter._emit.md +0 -50
- package/docs/api/foundation-events.typedemitter.md +0 -37
- package/docs/api/index.md +0 -30
- package/docs/api-report.md.api.md +0 -468
package/README.md
CHANGED
|
@@ -1,115 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @genesislcap/foundation-events
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- Contains [event emitting utilities](./src/eventEmitter/README.md).
|
|
6
|
-
- Contains common system level:
|
|
7
|
-
- Custom event types
|
|
8
|
-
- Custom event [detail interfaces](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)
|
|
9
|
-
- Custom event type to detail maps
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
export interface ZooEventDetail {
|
|
13
|
-
animals: Animal[];
|
|
14
|
-
location: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type MyEventDetailMap = {
|
|
18
|
-
'domain-foo': void; // < no detail
|
|
19
|
-
'domain-bar': boolean; // < boolean detail
|
|
20
|
-
'domain-zoo': ZooEventDetail; // < ZooEventDetail detail (more than one prop on details)
|
|
21
|
-
'domain-zoo-animals': Animal[]; // array of Animals detail
|
|
22
|
-
'domain-coo': number; // < number
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Event naming
|
|
27
|
-
|
|
28
|
-
We need to come up with an event naming strategy that scales well, avoids clashing, and sets out well known system
|
|
29
|
-
events for our micro frontends handle. Ideally these should be additive as we evolve to avoid breaking changes. For
|
|
30
|
-
example a user will always login, logout, etc, and these should be the same across all apps and not need to change much.
|
|
31
|
-
Payloads themselves may be more likely to change overtime, and we need to figure out how to deal with that.
|
|
32
|
-
|
|
33
|
-
Some notes on possible topic / event naming conventions. Note these show . delimiter but we'd probably use -
|
|
34
|
-
|
|
35
|
-
[https://devshawn.com/blog/apache-kafka-topic-naming-conventions/](https://devshawn.com/blog/apache-kafka-topic-naming-conventions/)
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
<data-center>.<domain>.<classification>.<description>.<version>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
aws.analytics.fct.pageviews.0
|
|
43
|
-
azure.comms.fct.gps.0
|
|
44
|
-
dc1.identity.cdc.users.1
|
|
45
|
-
gcp.notifications.cmd.emails.3
|
|
46
|
-
gcp.notifications.sys.email-cache.0
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Note: using version in the naming seems controversial, further reading required.
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
public.com.xeotek.sales.ecommerce.shoppingcarts
|
|
53
|
-
public.sales.ecommerce.shoppingcarts
|
|
54
|
-
private.risk.portfolio.analysis.loans.csvimport
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
As a phase of processing:
|
|
58
|
-
```
|
|
59
|
-
org.ntent.addelivery.pageview-incoming
|
|
60
|
-
org.ntent.addelivery.pageview-filtered
|
|
61
|
-
org.ntent.addelivery.pageview-duplicate
|
|
62
|
-
org.ntent.addelivery.pageview-clean
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
To separate "instances" of a particular kind of activity:
|
|
66
|
-
```
|
|
67
|
-
org.ntent.addelivery.feedrequest-feed1
|
|
68
|
-
org.ntent.addelivery.feedrequest-feed2
|
|
69
|
-
org.ntent.addelivery.feedrequest-feed3
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
To denote the type of "statistic":
|
|
73
|
-
```
|
|
74
|
-
org.ntent.addelivery.filterstats-knownoffender
|
|
75
|
-
org.ntent.addelivery.filterstats-bot
|
|
76
|
-
org.ntent.addelivery.filterstats-clickrate
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### [Module Federation Details](https://webpack.js.org/concepts/module-federation):
|
|
81
|
-
|
|
82
|
-
| Remote Name | Port |
|
|
83
|
-
| --------------------- | ----- |
|
|
84
|
-
| foundationEvents | 3060 |
|
|
85
|
-
|
|
86
|
-
[](https://lerna.js.org/)
|
|
87
|
-
[](https://www.typescriptlang.org/)
|
|
3
|
+
Documentation for this package is published on the Genesis docs site:
|
|
88
4
|
|
|
5
|
+
**Docs: [Utility methods](https://docs.genesis.global/docs/develop/client-capabilities/utility-methods/)**
|
|
89
6
|
|
|
90
7
|
## Installation
|
|
91
8
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
1. Add `@genesislcap/foundation-events` as a dependency in your `package.json` file. Whenever you change the dependencies of your project, ensure you run the `$ npm run bootstrap` command again. You can find more information in the [package.json basics](https://learn.genesis.global/secure/web/basics/package-json-basics/) page.
|
|
9
|
+
Add the package to your `package.json` dependencies. After changing dependencies, run `npm run bootstrap` (or your project's equivalent). See [package.json basics](https://learn.genesis.global/secure/web/basics/package-json-basics/) for more information.
|
|
95
10
|
|
|
96
11
|
```json
|
|
97
12
|
{
|
|
98
|
-
...
|
|
99
13
|
"dependencies": {
|
|
100
|
-
...
|
|
101
14
|
"@genesislcap/foundation-events": "latest"
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
...
|
|
15
|
+
}
|
|
105
16
|
}
|
|
106
17
|
```
|
|
107
18
|
|
|
108
|
-
## [API Docs](./docs/api/index.md)
|
|
109
|
-
|
|
110
19
|
## License
|
|
111
20
|
|
|
112
21
|
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
|
|
113
22
|
|
|
114
23
|
### Licensed components
|
|
24
|
+
|
|
115
25
|
Genesis low-code platform
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-events",
|
|
3
3
|
"description": "Genesis Foundation Events",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.409.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@genesislcap/foundation-testing": "14.
|
|
55
|
-
"@genesislcap/genx": "14.
|
|
56
|
-
"@genesislcap/rollup-builder": "14.
|
|
57
|
-
"@genesislcap/ts-builder": "14.
|
|
58
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
59
|
-
"@genesislcap/vite-builder": "14.
|
|
60
|
-
"@genesislcap/webpack-builder": "14.
|
|
54
|
+
"@genesislcap/foundation-testing": "14.409.0",
|
|
55
|
+
"@genesislcap/genx": "14.409.0",
|
|
56
|
+
"@genesislcap/rollup-builder": "14.409.0",
|
|
57
|
+
"@genesislcap/ts-builder": "14.409.0",
|
|
58
|
+
"@genesislcap/uvu-playwright-builder": "14.409.0",
|
|
59
|
+
"@genesislcap/vite-builder": "14.409.0",
|
|
60
|
+
"@genesislcap/webpack-builder": "14.409.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@genesislcap/foundation-logger": "14.
|
|
63
|
+
"@genesislcap/foundation-logger": "14.409.0",
|
|
64
64
|
"@microsoft/fast-element": "1.14.0",
|
|
65
65
|
"@microsoft/fast-foundation": "2.50.0"
|
|
66
66
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "cbe0459d170f27c35a7de18cec415947aedf4da5"
|
|
76
76
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [ConstructableTypedEventEmitter](./foundation-events.constructabletypedeventemitter.md)
|
|
4
|
-
|
|
5
|
-
## ConstructableTypedEventEmitter type
|
|
6
|
-
|
|
7
|
-
> Warning: This API is now obsolete.
|
|
8
|
-
>
|
|
9
|
-
> - Use [EventEmitterTarget](./foundation-events.eventemittertarget.md) type instead.
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
**Signature:**
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
export type ConstructableTypedEventEmitter = Constructable<FASTElement & HTMLElement>;
|
|
16
|
-
```
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [createInputEmitter](./foundation-events.createinputemitter.md)
|
|
4
|
-
|
|
5
|
-
## createInputEmitter() function
|
|
6
|
-
|
|
7
|
-
`<input>` template emit helper.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
createInputEmitter: <TEventDetailMap extends EventDetailMap>() => <K extends KeysMatching<TEventDetailMap, string>>(type: K, options?: EmitOptions) => Binding
|
|
13
|
-
```
|
|
14
|
-
**Returns:**
|
|
15
|
-
|
|
16
|
-
<K extends [KeysMatching](./foundation-events.keysmatching.md)<!-- --><TEventDetailMap, string>>(type: K, options?: [EmitOptions](./foundation-events.emitoptions.md)<!-- -->) => Binding
|
|
17
|
-
|
|
18
|
-
## Remarks
|
|
19
|
-
|
|
20
|
-
In some.template.ts file you create the helper upfront by passing in the full event map.
|
|
21
|
-
|
|
22
|
-
## Example
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
const inputEmit = createInputEmitter<EventMap>();
|
|
27
|
-
...
|
|
28
|
-
<zero-text-field @change="${inputEmit('some-input-changed')}">
|
|
29
|
-
```
|
|
30
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [createSelectEmitter](./foundation-events.createselectemitter.md)
|
|
4
|
-
|
|
5
|
-
## createSelectEmitter() function
|
|
6
|
-
|
|
7
|
-
`<select>` template emit helper.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
createSelectEmitter: <TEventDetailMap extends EventDetailMap>() => <K extends KeysMatching<TEventDetailMap, string>>(type: K, options?: EmitOptions) => Binding
|
|
13
|
-
```
|
|
14
|
-
**Returns:**
|
|
15
|
-
|
|
16
|
-
<K extends [KeysMatching](./foundation-events.keysmatching.md)<!-- --><TEventDetailMap, string>>(type: K, options?: [EmitOptions](./foundation-events.emitoptions.md)<!-- -->) => Binding
|
|
17
|
-
|
|
18
|
-
## Remarks
|
|
19
|
-
|
|
20
|
-
In some.template.ts file you create the helper upfront by passing in the full event map.
|
|
21
|
-
|
|
22
|
-
## Example
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
const selectEmit = createSelectEmitter<EventMap>();
|
|
27
|
-
...
|
|
28
|
-
<zero-select @change="${selectEmit('some-select-changed')}">
|
|
29
|
-
```
|
|
30
|
-
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [customEvent](./foundation-events.customevent.md)
|
|
4
|
-
|
|
5
|
-
## customEvent() function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
customEvent: <TEventDetail = void>(ctx: ExecutionContext) => CustomEvent<TEventDetail>
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Parameters
|
|
15
|
-
|
|
16
|
-
<table><thead><tr><th>
|
|
17
|
-
|
|
18
|
-
Parameter
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</th><th>
|
|
22
|
-
|
|
23
|
-
Type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</th><th>
|
|
27
|
-
|
|
28
|
-
Description
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</th></tr></thead>
|
|
32
|
-
<tbody><tr><td>
|
|
33
|
-
|
|
34
|
-
ctx
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</td><td>
|
|
38
|
-
|
|
39
|
-
ExecutionContext
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</td><td>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</td></tr>
|
|
46
|
-
</tbody></table>
|
|
47
|
-
|
|
48
|
-
**Returns:**
|
|
49
|
-
|
|
50
|
-
CustomEvent<TEventDetail>
|
|
51
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [CustomEventMap](./foundation-events.customeventmap.md)
|
|
4
|
-
|
|
5
|
-
## CustomEventMap type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type CustomEventMap<TEventDetailMap extends EventDetailMap> = {
|
|
12
|
-
[K in keyof TEventDetailMap]: CustomEvent<TEventDetailMap[K]>;
|
|
13
|
-
};
|
|
14
|
-
```
|
|
15
|
-
**References:** [EventDetailMap](./foundation-events.eventdetailmap.md)
|
|
16
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [DefaultEventEmitterDI](./foundation-events.defaulteventemitterdi.md) > [emit](./foundation-events.defaulteventemitterdi.emit.md)
|
|
4
|
-
|
|
5
|
-
## DefaultEventEmitterDI.emit() method
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
emit<K extends keyof TEventDetailMap>(...args: TEventDetailMap[K] extends void ? [origin: EmitOrigin, type: K, options?: EmitOptions] : [origin: EmitOrigin, type: K, detail: TEventDetailMap[K], options?: EmitOptions]): EmitReturn;
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Parameters
|
|
14
|
-
|
|
15
|
-
<table><thead><tr><th>
|
|
16
|
-
|
|
17
|
-
Parameter
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</th><th>
|
|
21
|
-
|
|
22
|
-
Type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</th><th>
|
|
26
|
-
|
|
27
|
-
Description
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</th></tr></thead>
|
|
31
|
-
<tbody><tr><td>
|
|
32
|
-
|
|
33
|
-
args
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</td><td>
|
|
37
|
-
|
|
38
|
-
TEventDetailMap\[K\] extends void ? \[origin: [EmitOrigin](./foundation-events.emitorigin.md)<!-- -->, type: K, options?: [EmitOptions](./foundation-events.emitoptions.md)<!-- -->\] : \[origin: [EmitOrigin](./foundation-events.emitorigin.md)<!-- -->, type: K, detail: TEventDetailMap\[K\], options?: [EmitOptions](./foundation-events.emitoptions.md)<!-- -->\]
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</td><td>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</td></tr>
|
|
45
|
-
</tbody></table>
|
|
46
|
-
|
|
47
|
-
**Returns:**
|
|
48
|
-
|
|
49
|
-
[EmitReturn](./foundation-events.emitreturn.md)
|
|
50
|
-
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [DefaultEventEmitterDI](./foundation-events.defaulteventemitterdi.md)
|
|
4
|
-
|
|
5
|
-
## DefaultEventEmitterDI class
|
|
6
|
-
|
|
7
|
-
Default EventEmitterDI.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
export declare class DefaultEventEmitterDI<TEventDetailMap extends EventDetailMap> implements EventEmitterDI<TEventDetailMap>
|
|
13
|
-
```
|
|
14
|
-
**Implements:** [EventEmitterDI](./foundation-events.eventemitterdi.md)<!-- --><TEventDetailMap>
|
|
15
|
-
|
|
16
|
-
## Methods
|
|
17
|
-
|
|
18
|
-
<table><thead><tr><th>
|
|
19
|
-
|
|
20
|
-
Method
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</th><th>
|
|
24
|
-
|
|
25
|
-
Modifiers
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</th><th>
|
|
29
|
-
|
|
30
|
-
Description
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</th></tr></thead>
|
|
34
|
-
<tbody><tr><td>
|
|
35
|
-
|
|
36
|
-
[emit(args)](./foundation-events.defaulteventemitterdi.emit.md)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</td><td>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</td><td>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</td></tr>
|
|
46
|
-
</tbody></table>
|
|
47
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [EmitArgs](./foundation-events.emitargs.md)
|
|
4
|
-
|
|
5
|
-
## EmitArgs type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type EmitArgs = [string, {} | undefined, EmitOptions | undefined];
|
|
12
|
-
```
|
|
13
|
-
**References:** [EmitOptions](./foundation-events.emitoptions.md)
|
|
14
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [EmitOptions](./foundation-events.emitoptions.md)
|
|
4
|
-
|
|
5
|
-
## EmitOptions type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type EmitOptions = Omit<CustomEventInit, 'detail'> & {
|
|
12
|
-
broadcast?: boolean;
|
|
13
|
-
};
|
|
14
|
-
```
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [EmitOrigin](./foundation-events.emitorigin.md)
|
|
4
|
-
|
|
5
|
-
## EmitOrigin type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type EmitOrigin = FASTElement;
|
|
12
|
-
```
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [EmitReturn](./foundation-events.emitreturn.md)
|
|
4
|
-
|
|
5
|
-
## EmitReturn type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type EmitReturn = boolean | void;
|
|
12
|
-
```
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [emitter](./foundation-events.emitter.md)
|
|
4
|
-
|
|
5
|
-
## emitter() function
|
|
6
|
-
|
|
7
|
-
emitter function.
|
|
8
|
-
|
|
9
|
-
This is the functional equivalent of the strongly typed `.emit` function created with the [EventEmitter()](./foundation-events.eventemitter.md) mixin.
|
|
10
|
-
|
|
11
|
-
**Signature:**
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
emitter: <TEventDetailMap extends EventDetailMap>() => {
|
|
15
|
-
emit: <K extends keyof TEventDetailMap>(...args: TEventDetailMap[K] extends void ? [origin: HTMLElement, type: K, options?: EmitOptions] : [origin: HTMLElement, type: K, detail: TEventDetailMap[K], options?: EmitOptions]) => void;
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
**Returns:**
|
|
19
|
-
|
|
20
|
-
{ emit: <K extends keyof TEventDetailMap>(...args: TEventDetailMap\[K\] extends void ? \[origin: HTMLElement, type: K, options?: [EmitOptions](./foundation-events.emitoptions.md)<!-- -->\] : \[origin: HTMLElement, type: K, detail: TEventDetailMap\[K\], options?: [EmitOptions](./foundation-events.emitoptions.md)<!-- -->\]) => void; }
|
|
21
|
-
|
|
22
|
-
## Remarks
|
|
23
|
-
|
|
24
|
-
This is useful if you need to emit an event from an arbitrary location. For example, if you want to emit an event from a button on a custom grid cell renderer you can use this to get strong typing rather than having to dependency inject a reference to the class which uses the [EventEmitter()](./foundation-events.eventemitter.md) mixin multiple levels into the renderer.
|
|
25
|
-
|
|
26
|
-
## Example
|
|
27
|
-
|
|
28
|
-
Apply mixin to the base
|
|
29
|
-
|
|
30
|
-
\# Import
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
import { emitter, SomeSystemLevelEventDetailMap } from '@genesislcap/foundation-events';
|
|
34
|
-
import { StoreEventDetailMap, TradeEntryEventDetailMap } from '../store'; // < custom app level event maps
|
|
35
|
-
```
|
|
36
|
-
\# Create event map
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
type EventMap = SomeSystemLevelEventDetailMap & StoreEventDetailMap & TradeEntryEventDetailMap;
|
|
40
|
-
```
|
|
41
|
-
\# Use the functional emitter. For example in a custom button action on a grid cell
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
const customAction = {
|
|
45
|
-
name: `<rapid-button name="download" size="lg"></rapid-button>`
|
|
46
|
-
callback: (button: HTMLElement, data: RowData) =>
|
|
47
|
-
emitter<EventMap>().emit(
|
|
48
|
-
button,
|
|
49
|
-
'some-allowed-event',
|
|
50
|
-
{ foo: 'expected data structure' },
|
|
51
|
-
),
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-events](./foundation-events.md) > [EventDetailMap](./foundation-events.eventdetailmap.md)
|
|
4
|
-
|
|
5
|
-
## EventDetailMap type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export type EventDetailMap = Record<string, unknown>;
|
|
12
|
-
```
|