Docs: how to use
This commit is contained in:
parent
16da64c814
commit
2b28def262
35
README.md
35
README.md
|
|
@ -8,6 +8,8 @@ Javascript SDK for CloudEvents
|
||||||
├── lib
|
├── lib
|
||||||
│ ├── cloudevent.js
|
│ ├── cloudevent.js
|
||||||
│ ├── jsonformatter.js
|
│ ├── jsonformatter.js
|
||||||
|
│ ├── format
|
||||||
|
│ │ └── json_0_1.js
|
||||||
│ ├── spec_0_1.js
|
│ ├── spec_0_1.js
|
||||||
│ └── spec_0_2.js
|
│ └── spec_0_2.js
|
||||||
├── LICENSE
|
├── LICENSE
|
||||||
|
|
@ -19,13 +21,36 @@ Javascript SDK for CloudEvents
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* `index.js`: exports the Cloudevent class
|
* `index.js`: library exports
|
||||||
|
|
||||||
* `lib/cloudevent.js`: implementation of Cloudevent class
|
* `lib/cloudevent.js`: implementation of Cloudevent, an interface
|
||||||
|
|
||||||
* `lib/jsonformatter.js`: implementation for JSON formatting [json-format](https://github.com/cloudevents/spec/blob/v0.1/json-format.md)
|
* `lib/format/json_0_1.js`: implementation for JSON formatting [version 0.1](https://github.com/cloudevents/spec/blob/v0.1/json-format.md)
|
||||||
|
|
||||||
* `lib/spec_0_1.js`: implementation for spec version 0.1
|
* `lib/spec_0_1.js`: implementation for spec [version 0.1](https://github.com/cloudevents/spec/blob/v0.1/spec.md)
|
||||||
|
|
||||||
* `lib/spec_0_2.js`: implementation for spec version 0.2
|
* `lib/spec_0_2.js`: implementation for spec [version 0.2](https://github.com/cloudevents/spec/blob/master/spec.md)
|
||||||
|
|
||||||
|
* `test/cloudevent_spec_0_1.js`: unit testing for spec 0.1
|
||||||
|
|
||||||
|
* `test/cloudevent_spec_0_2.js`: unit testing for spec 0.2
|
||||||
|
|
||||||
|
# How to use
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constructs a default instance with:
|
||||||
|
* - Spec 0.1
|
||||||
|
* - JSON Format 0.1
|
||||||
|
*/
|
||||||
|
var cloudevent01 = new Cloudevent();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constructs an instance with:
|
||||||
|
* - Spec 0.2
|
||||||
|
* - JSON Format 0.1
|
||||||
|
*/
|
||||||
|
var cloudevent02 = new Cloudevent(Cloudevent.specs['0.2']);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue