File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,29 @@ const ce = new CloudEvent({...});
132132const ce2 = ce .cloneWith ({extension: " Value" });
133133```
134134
135+ You can create a ` CloudEvent ` object in many ways, for example, in TypeScript:
136+
137+ ``` js
138+ import { CloudEvent , CloudEventV1 , CloudEventV1Attributes } from " cloudevents" ;
139+ const ce: CloudEventV1 <string > = {
140+ specversion: ' 1.0' ,
141+ source: ' /some/source' ,
142+ type: ' example' ,
143+ id: ' 1234'
144+ };
145+ const event = new CloudEvent (ce);
146+ const ce2: CloudEventV1Attributes <string > = {
147+ specversion: ' 1.0' ,
148+ source: ' /some/source' ,
149+ type: ' example' ,
150+ };
151+ const event2 = new CloudEvent (ce2);
152+ const event3 = new CloudEvent ({
153+ source: ' /some/source' ,
154+ type: ' example' ,
155+ });
156+ ```
157+
135158### Example Applications
136159
137160There are a few trivial example applications in
You can’t perform that action at this time.
0 commit comments