Skip to content

Commit

Permalink
adding configuration to info message.
Browse files Browse the repository at this point in the history
TODO: add udevStatus to the same call
  • Loading branch information
karelbilek committed Sep 16, 2015
1 parent 08a9fcc commit 99f5197
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import type {Messages} from "./protobuf/messages";

type MessageToTrezor = {id: ?number, type: ?string, message: Object};
type MessageFromTrezor = {type: string, message: Object};
type StatusInfo = {version: string, configured: boolean}

// description of messages, loaded by configure
// if null -> not configured yet
var messages: ?Messages = null;

var responseFunctions = {
ping: tasks.ping,
version: tasks.version,
enumerate: tasks.enumerate,
listen: tasks.listen,
acquire: tasks.acquire,
Expand All @@ -59,7 +59,16 @@ var responseFunctions = {
}).then(function (): string {
return "Success"
});
}
},

info: function(): Promise<StatusInfo> {
return tasks.version().then(function (version: string): StatusInfo {
return {
version: version,
configured: messages == null
};
})
},
}

function handleMessage(request: Object, sender: ChromeMessageSender, sendResponse: (response: Object) => void): boolean {
Expand Down

0 comments on commit 99f5197

Please sign in to comment.