Skip to content

Commit

Permalink
improving typescript.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Apr 16, 2016
1 parent e278ea6 commit 2916b19
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea/
node_modules/
coverage/
*.map

typescript/*.js
test/typescript/*.js
test/typescript/*.map
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pg-monitor",
"version": "0.5.1",
"version": "0.5.2",
"description": "Event monitor for pg-promise.",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions test/typescript/basic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="../../typescript/pg-monitor.d.ts" />
/// <reference path="../../typescript/pg-monitor" />

import * as pgMonitor from "pg-monitor";

Expand Down Expand Up @@ -27,7 +27,7 @@ pgMonitor.setTheme({
tx: null,
paramTitle: null,
errorTitle: null,
query: null,
query: ()=>{},
special: null,
error: null
});
Expand Down
7 changes: 5 additions & 2 deletions typescript/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
### TypeScript for pg-monitor

Complete TypeScript declarations for [pg-monitor] version 0.5.0 or later.
Complete TypeScript ambient declarations for [pg-monitor] version 0.5.0 or later.

#### Usage

```ts
/// <reference path="node_modules/pg-monitor/typescript/pg-monitor.d.ts" />
/// <reference path="node_modules/pg-monitor/typescript/pg-monitor" />

import * as pgMonitor from "pg-monitor";

Expand All @@ -14,6 +14,9 @@ var pgOptions = {
};

pgMonitor.attach(pgOptions);

// optionally, changing the default theme:
pgMonitor.setTheme('matrix');
```

[pg-monitor]:https://github.com/vitaly-t/pg-monitor
10 changes: 5 additions & 5 deletions typescript/pg-monitor.d.ts → typescript/pg-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

declare module "pg-monitor" {

interface ColorTheme {
interface IColorTheme {
time:Function;
value:Function;
cn:Function;
Expand All @@ -16,7 +16,7 @@ declare module "pg-monitor" {
error:Function;
}

interface EventInfo {
interface IEventInfo {
time:Date;
text:string;
event:string;
Expand All @@ -26,7 +26,7 @@ declare module "pg-monitor" {
namespace pgMonitor {

export function attach(options:Object, events?:Array<string>, override?:boolean):void;

export function attach(options:{
options:Object,
events?:Array<string>,
Expand All @@ -35,9 +35,9 @@ declare module "pg-monitor" {

export function detach():void;

export function setTheme(theme:string|ColorTheme):void;
export function setTheme(theme:string|IColorTheme):void;

export function log(msg:string, info:EventInfo):void;
export function log(msg:string, info:IEventInfo):void;

export var detailed:boolean;

Expand Down

0 comments on commit 2916b19

Please sign in to comment.