Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
start on documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Crisci committed Feb 27, 2019
1 parent 1fd7bd8 commit 412bcc5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pids
logs
results
/coverage
/out

node_modules
npm-debug.log
Expand Down
3 changes: 3 additions & 0 deletions jsdoc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["plugins/markdown"]
}
2 changes: 1 addition & 1 deletion lib/marshallers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {
MAX_UINT64_STR, MIN_UINT64_STR
} = require('./constants');

/**
/*
* MakeSimpleMarshaller
* @param signature - the signature of the data you want to check
* @returns a simple marshaller with the "check" method
Expand Down
33 changes: 33 additions & 0 deletions lib/service/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ let {
assertMemberNameValid
} = require('../validators');

/**
* An error that can be thrown from DBus methods and property getters and
* setters to return the error to the client.
*
* @param {string} type - The type of error. Must be a valid DBus member name.
* @param {string} text - The error text. Will be seen by the client.
*/
class DBusError extends Error {
constructor(type, text) {
assertInterfaceNameValid(type);
Expand All @@ -21,6 +28,32 @@ class DBusError extends Error {
}
}

/**
* A decorator function to define an Interface class member as a property. The
* property will be gotten and set from the class when users call the standard
* DBus methods `org.freedesktop.DBus.Properties.Get`,
* `org.freedesktop.DBus.Properties.Set`, and
* `org.freedesktop.DBus.Properties.GetAll`.
*
* @example
* class MyInterface extends Interface {
* // use a @ in place of {at} (jsdoc bug)
* {at}property({signature: 's'})
* get MyProp() {
* return this.myProp;
* }
* set MyProp(value) {
* this.myProp = value;
* }
* }
*
* @param {object} options - The options for this property.
* @param {string} options.signature - The DBus type signature for this property.
* @param {string} [options.name] - The name of this property on the bus.
* Defaults to the name of the class member being decorated.
* @param {bool} [options.disabled=false] - Whether or not this property
* will be advertized on the bus.
*/
function property(options) {
options.access = options.access || ACCESS_READWRITE;
if (!options.signature) {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"commander": "^2.19.0",
"jest": "^24.1.0"
"jest": "^24.1.0",
"jsdoc": "git+https://github.com/jsdoc3/jsdoc.git"
},
"scripts": {
"integration": "dbus-run-session -- jest ./test/integration",
"coverage": "dbus-run-session -- jest --coverage",
"unit": "jest ./test/*.test.js",
"test": "dbus-run-session -- jest"
"test": "dbus-run-session -- jest",
"doc": "jsdoc --verbose -c jsdoc.conf --readme README.md --package package.json -r lib"
},
"engine": {
"node": ">=8.2.1"
Expand Down

0 comments on commit 412bcc5

Please sign in to comment.