sdk-javascript/README.md

1.3 KiB

sdk-javascript

Javascript SDK for CloudEvents

Repository Structure

├── index.js
├── lib
│   ├── cloudevent.js
│   ├── jsonformatter.js
│   ├── format
│   │   └── json_0_1.js
│   ├── spec_0_1.js
│   └── spec_0_2.js
├── LICENSE
├── package.json
├── README.md
└── test
    ├── cloudevent_spec_0_1.js
    └── cloudevent_spec_0_2.js

  • index.js: library exports

  • lib/cloudevent.js: implementation of Cloudevent, an interface

  • lib/format/json_0_1.js: implementation for JSON formatting version 0.1

  • lib/spec_0_1.js: implementation for spec version 0.1

  • lib/spec_0_2.js: implementation for spec version 0.2

  • 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


/* 
 * 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']);