This commit is contained in:
Rogier Schouten
2014-06-27 10:36:32 +02:00
10 changed files with 159 additions and 20 deletions
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="chalk.d.ts" />
import chalk = require('chalk');
var str: string;
var bool: boolean;
chalk.enabled = bool;
str = chalk.stripColor(str);
bool = chalk.supportsColor;
bool = chalk.hasColor(str);
// style a string
console.log( chalk.blue('Hello world!') );
// combine styled and normal strings
console.log( chalk.blue('Hello'), 'World' + chalk.red('!') );
// compose multiple styles using the chainable API
console.log( chalk.blue.bgRed.bold('Hello world!') );
// pass in multiple arguments
console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') );
// nest styles
console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );
// nest styles of the same type even (color, underline, background)
console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') );
+92
View File
@@ -0,0 +1,92 @@
// Type definitions for chalk v0.4.0
// Project: https://github.com/sindresorhus/chalk
// Definitions by: Diullei Gomes <https://github.com/Diullei>, Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Chalk {
export interface ChalkModule extends ChalkStyle {
enabled: boolean;
supportsColor: boolean;
styles: ChalkStyleMap;
stripColor(value: string): any;
hasColor(str: string): boolean;
}
export interface ChalkChain extends ChalkStyle {
(...text: string[]): ChalkChain;
}
export interface ChalkStyleElement {
open: string;
close: string;
}
export interface ChalkStyle {
// General
reset: ChalkChain;
bold: ChalkChain;
italic: ChalkChain;
underline: ChalkChain;
inverse: ChalkChain;
strikethrough: ChalkChain;
// Text colors
black: ChalkChain;
red: ChalkChain;
green: ChalkChain;
yellow: ChalkChain;
blue: ChalkChain;
magenta: ChalkChain;
cyan: ChalkChain;
white: ChalkChain;
gray: ChalkChain;
// Background colors
bgBlack: ChalkChain;
bgRed: ChalkChain;
bgGreen: ChalkChain;
bgYellow: ChalkChain;
bgBlue: ChalkChain;
bgMagenta: ChalkChain;
bgCyan: ChalkChain;
bgWhite: ChalkChain;
}
export interface ChalkStyleMap {
// General
reset: ChalkStyleElement;
bold: ChalkStyleElement;
italic: ChalkStyleElement;
underline: ChalkStyleElement;
inverse: ChalkStyleElement;
strikethrough: ChalkStyleElement;
// Text colors
black: ChalkStyleElement;
red: ChalkStyleElement;
green: ChalkStyleElement;
yellow: ChalkStyleElement;
blue: ChalkStyleElement;
magenta: ChalkStyleElement;
cyan: ChalkStyleElement;
white: ChalkStyleElement;
gray: ChalkStyleElement;
// Background colors
bgBlack: ChalkStyleElement;
bgRed: ChalkStyleElement;
bgGreen: ChalkStyleElement;
bgYellow: ChalkStyleElement;
bgBlue: ChalkStyleElement;
bgMagenta: ChalkStyleElement;
bgCyan: ChalkStyleElement;
bgWhite: ChalkStyleElement;
}
}
declare module "chalk" {
var ch: Chalk.ChalkModule;
export = ch;
}
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for flipsnap.js
// Project: http://pxgrid.github.io/js-flipsnap/
// Definitions by: kubosho_ <https://github.com/kubosho>, gsino <https://github.com/gsino>, Mayuki Sawatari <https://github.com/mayuki>
// Definitions by: kubosho <https://github.com/kubosho>, gsino <https://github.com/gsino>, Mayuki Sawatari <https://github.com/mayuki>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface IFlipsnap {
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="glob-stream" />
/// <reference path="glob-stream.d.ts" />
import gs = require('glob-stream');
+1
View File
@@ -21,6 +21,7 @@ declare module "glob" {
var Glob:IGlobStatic;
interface IOptions extends minimatch.IOptions {
cwd?: string;
sync?: boolean;
nomount?: boolean;
matchBase?:any;
+1 -2
View File
@@ -1,7 +1,6 @@
// Type definitions for Hammer.js 1.1.3
// Project: http://eightmedia.github.com/hammer.js/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Drew Noakes <https://drewnoakes.com>
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Drew Noakes <https://drewnoakes.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
+16
View File
@@ -33,10 +33,17 @@ peripheral.advertisement = {
manufacturerData: new Buffer(1),
serviceUuids: ["0x180a", "0x180d"]
};
peripheral.connect();
peripheral.connect((error: string): void => {});
peripheral.disconnect();
peripheral.disconnect((): void => {});
peripheral.updateRssi();
peripheral.updateRssi((error: string, rssi: number): void => {});
peripheral.discoverServices(["180d"]);
peripheral.discoverServices(["180d"], (error: string, services: noble.Service[]): void => {});
peripheral.discoverAllServicesAndCharacteristics();
peripheral.discoverAllServicesAndCharacteristics((error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {});
peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"]);
peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"], (error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {});
peripheral.readHandle(new Buffer(1), (error: string, data: NodeBuffer): void => {});
peripheral.writeHandle(new Buffer(1), new Buffer(1), true, (error: string): void => {});
@@ -50,7 +57,9 @@ service.uuid = "180a";
service.name = "";
service.type = "";
service.includedServiceUuids = ["180d"];
service.discoverIncludedServices(["180d"]);
service.discoverIncludedServices(["180d"], (error: string, includedServiceUuids: string[]): void => {});
service.discoverCharacteristics(["2a38"]);
service.discoverCharacteristics(["2a38"], (error: string, characteristics: noble.Characteristic[]): void => {});
service.on("includedServicesDiscover", (includedServiceUuids: string[]): void => {});
service.on("characteristicsDiscover", (characteristics: noble.Characteristic[]): void => {});
@@ -60,10 +69,15 @@ characteristic.uuid = "2a37";
characteristic.name = "";
characteristic.type = "";
characteristic.properties = ["read", "notify"];
characteristic.read();
characteristic.read((error: string, data: NodeBuffer): void => {});
characteristic.write(new Buffer(1), true);
characteristic.write(new Buffer(1), true, (error: string): void => {});
characteristic.broadcast(true);
characteristic.broadcast(true, (error: string): void => {});
characteristic.notify(true);
characteristic.notify(true, (error: string): void => {});
characteristic.discoverDescriptors();
characteristic.discoverDescriptors((error: string, descriptors: noble.Descriptor[]): void => {});
characteristic.on("read", (data: NodeBuffer, isNotification: boolean): void => {});
characteristic.on("write", true, (error: string): void => {});
@@ -75,7 +89,9 @@ var descriptor: noble.Descriptor = new noble.Descriptor();
descriptor.uuid = "";
descriptor.name = "";
descriptor.type = "";
descriptor.readValue();
descriptor.readValue((error: string, data: NodeBuffer): void => {});
descriptor.writeValue(new Buffer(1));
descriptor.writeValue(new Buffer(1), (error: string): void => {});
descriptor.on("valueRead", (error: string, data: NodeBuffer): void => {});
descriptor.on("valueWrite", (error: string): void => {});
+15 -14
View File
@@ -25,11 +25,12 @@ declare module "noble" {
rssi: number;
services: string[];
connect(callback: (error: string) => void): void;
disconnect(callback: () => void): void;
discoverServices(serviceUUIDs: string[], listener: (error: string, services: Service[]) => void): void;
discoverAllServicesAndCharacteristics(callback: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
discoverSomeServicesAndCharacteristics(serviceUUIDs: string[], characteristicUUIDs: string[], callback: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
connect(callback?: (error: string) => void): void;
disconnect(callback?: () => void): void;
updateRssi(callback?: (error: string, rssi: number) => void): void;
discoverServices(serviceUUIDs: string[], callback?: (error: string, services: Service[]) => void): void;
discoverAllServicesAndCharacteristics(callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
discoverSomeServicesAndCharacteristics(serviceUUIDs: string[], characteristicUUIDs: string[], callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void;
readHandle(handle: NodeBuffer, callback: (error: string, data: NodeBuffer) => void): void;
writeHandle(handle: NodeBuffer, data: NodeBuffer, withoutResponse: boolean, callback: (error: string) => void): void;
@@ -57,8 +58,8 @@ declare module "noble" {
includedServiceUuids: string[];
characteristics: Characteristic[];
discoverIncludedServices(serviceUUIDs: string[], callback: (error: string, includedServiceUuids: string[]) => void): void;
discoverCharacteristics(characteristicUUIDs: string[], callback: (error: string, characteristics: Characteristic[]) => void): void;
discoverIncludedServices(serviceUUIDs: string[], callback?: (error: string, includedServiceUuids: string[]) => void): void;
discoverCharacteristics(characteristicUUIDs: string[], callback?: (error: string, characteristics: Characteristic[]) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
@@ -73,11 +74,11 @@ declare module "noble" {
properties: string[];
descriptors: Descriptor[];
read(callback: (error: string, data: NodeBuffer) => void): void;
write(data: NodeBuffer, notify: boolean, callback: (error: string) => void): void;
broadcast(broadcast: boolean, callback: (error: string) => void): void;
notify(notify: boolean, callback: (error: string) => void): void;
discoverDescriptors(callback: (error: string, descriptors: Descriptor[]) => void): void;
read(callback?: (error: string, data: NodeBuffer) => void): void;
write(data: NodeBuffer, notify: boolean, callback?: (error: string) => void): void;
broadcast(broadcast: boolean, callback?: (error: string) => void): void;
notify(notify: boolean, callback?: (error: string) => void): void;
discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
@@ -94,8 +95,8 @@ declare module "noble" {
name: string;
type: string;
readValue(callback: (error: string, data: NodeBuffer) => void): void;
writeValue(data: NodeBuffer, callback: (error: string) => void): void;
readValue(callback?: (error: string, data: NodeBuffer) => void): void;
writeValue(data: NodeBuffer, callback?: (error: string) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
+1 -1
View File
@@ -763,7 +763,7 @@ declare module "dgram" {
export function createSocket(type: string, callback?: Function): Socket;
interface Socket extends events.EventEmitter {
send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number)): void;
send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
bind(port: number, address?: string, callback?: () => void): void;
close(): void;
address: { address: string; family: string; port: number; };
+1 -1
View File
@@ -1,7 +1,7 @@
// Type definitions for sockjs-node 0.3.x
// Project: https://github.com/sockjs/sockjs-node
// Definitions by: Phil McCloghry-Laing <https://github.com/pmccloghrylaing>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />