Update the project structure
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
942df44bbe
commit
f65bcfa9dc
33
README.md
33
README.md
|
@ -8,8 +8,10 @@ Javascript SDK for CloudEvents
|
||||||
```text
|
```text
|
||||||
├── index.js
|
├── index.js
|
||||||
├── lib
|
├── lib
|
||||||
|
│ ├── bindings
|
||||||
|
│ │ └── http
|
||||||
|
│ │ └── structured_0_1.js
|
||||||
│ ├── cloudevent.js
|
│ ├── cloudevent.js
|
||||||
│ ├── jsonformatter.js
|
|
||||||
│ ├── format
|
│ ├── format
|
||||||
│ │ └── json_0_1.js
|
│ │ └── json_0_1.js
|
||||||
│ └── specs
|
│ └── specs
|
||||||
|
@ -20,12 +22,18 @@ Javascript SDK for CloudEvents
|
||||||
├── README.md
|
├── README.md
|
||||||
└── test
|
└── test
|
||||||
├── cloudevent_spec_0_1.js
|
├── cloudevent_spec_0_1.js
|
||||||
└── cloudevent_spec_0_2.js
|
├── cloudevent_spec_0_2.js
|
||||||
|
└── http_binding_0_1.js
|
||||||
```
|
```
|
||||||
|
|
||||||
* `index.js`: library exports
|
* `index.js`: library exports
|
||||||
|
|
||||||
|
* `lib/bindings`: every binding implementation goes here
|
||||||
|
|
||||||
|
* `lib/bindings/http`: every http binding implementation goes here
|
||||||
|
|
||||||
|
* `lib/bindings/http/structured_0_1.js`: implementation of structured HTTP Binding
|
||||||
|
|
||||||
* `lib/cloudevent.js`: implementation of Cloudevent, an interface
|
* `lib/cloudevent.js`: implementation of Cloudevent, an interface
|
||||||
|
|
||||||
* `lib/format/`: every format implementation goes here
|
* `lib/format/`: every format implementation goes here
|
||||||
|
@ -100,10 +108,27 @@ Every Spec class must implement these methods to work properly.
|
||||||
Spec(Cloudevent)
|
Spec(Cloudevent)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the spec constraints, throwing an error if do not pass.
|
* Checks the spec constraints, throwing an error if do not pass.
|
||||||
*/
|
*/
|
||||||
Spec.check()
|
Spec.check()
|
||||||
|
|
||||||
|
```
|
||||||
|
## `Binding` classes
|
||||||
|
|
||||||
|
Every Binding class must implement these methods to work properly.
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The constructor must receives the map of configurations.
|
||||||
|
*/
|
||||||
|
Binding(config)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Emits the event using an instance of Cloudevent.
|
||||||
|
*/
|
||||||
|
Binding.emit(cloudevent)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
|
|
Loading…
Reference in New Issue