mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 10:35:22 +08:00
* Adding graphite-udp typings * Cleaning up linting errors * Removing the namespacing that is not needed * Adding missing constructor typing, capitilizing the interface * Callback is optional
44 lines
850 B
TypeScript
44 lines
850 B
TypeScript
import graphite = require('graphite-udp');
|
|
|
|
// Test creation of client directly.
|
|
let client = new graphite.Client();
|
|
client.put('test', 1);
|
|
client.add('test', 1);
|
|
client.close();
|
|
|
|
// Create client with helper
|
|
let client2 = graphite.createClient();
|
|
client2.put('test2', 1);
|
|
client2.add('test2', 1);
|
|
client2.close();
|
|
|
|
// Test creation with options.
|
|
graphite.createClient({
|
|
host: '127.0.0.1',
|
|
port: 2003,
|
|
type: 'udp4',
|
|
maxPacketSize: 4096,
|
|
prefix: 'prefix',
|
|
suffix: 'suffix',
|
|
interval: 60 * 1000,
|
|
verbose: true,
|
|
callback: (error: Error, metrics: any): void => {
|
|
|
|
}
|
|
});
|
|
|
|
// Test creation options with class directly.
|
|
new graphite.Client({
|
|
host: '127.0.0.1',
|
|
port: 2003,
|
|
type: 'udp4',
|
|
maxPacketSize: 4096,
|
|
prefix: 'prefix',
|
|
suffix: 'suffix',
|
|
interval: 60 * 1000,
|
|
verbose: true,
|
|
callback: (error: Error, metrics: any): void => {
|
|
|
|
}
|
|
});
|