1
- import { CloudEvent , HTTPReceiver } from ' ../../..' ;
2
- import { CloudEventV1 } from ' ../../../lib/v1' ;
1
+ import { CloudEvent , HTTPReceiver } from " ../../.." ;
2
+ import { CloudEventV1 } from " ../../../lib/v1" ;
3
3
4
4
export function doSomeStuff ( ) {
5
5
const receiver = new HTTPReceiver ( ) ;
6
6
7
7
const myevent : CloudEventV1 = new CloudEvent ( {
8
- source : ' /source' ,
9
- type : ' type' ,
10
- dataContentType : ' text/plain' ,
11
- dataSchema : ' https://d.schema.com/my.json' ,
12
- subject : ' cha.json' ,
13
- data : ' my-data'
8
+ source : " /source" ,
9
+ type : " type" ,
10
+ dataContentType : " text/plain" ,
11
+ dataSchema : " https://d.schema.com/my.json" ,
12
+ subject : " cha.json" ,
13
+ data : " my-data"
14
14
} ) ;
15
- myevent . addExtension ( ' extension-1' , ' some extension data' ) ;
15
+ myevent . addExtension ( " extension-1" , " some extension data" ) ;
16
16
17
17
console . log ( "My structured event:" , myevent . toString ( ) ) ;
18
18
console . log ( "My structured event extensions:" , myevent . getExtensions ( ) ) ;
@@ -24,7 +24,7 @@ export function doSomeStuff() {
24
24
25
25
// Typically used with an incoming HTTP request where myevent.format() is the actual
26
26
// body of the HTTP
27
- console . log ( ' Received structured event:' , receiver . accept ( headers , myevent . format ( ) ) . toString ( ) ) ;
27
+ console . log ( " Received structured event:" , receiver . accept ( headers , myevent . format ( ) ) . toString ( ) ) ;
28
28
29
29
// ------ receiver binary
30
30
const data = {
0 commit comments