Merge remote-tracking branch 'borisyankov/master' into winrt

This commit is contained in:
Jordy Hulck
2015-08-31 20:40:08 +02:00
32 changed files with 1318 additions and 647 deletions
+33
View File
@@ -0,0 +1,33 @@
/// <reference path="codemirror.d.ts" />
/// <reference path="showhint.d.ts" />
var doc = new CodeMirror.Doc('text');
var pos = new CodeMirror.Pos(2, 3);
CodeMirror.showHint(doc);
CodeMirror.showHint(doc, function (cm) {
return {
from: pos,
list: ["one", "two"],
to: pos
};
});
CodeMirror.showHint(doc, function (cm) {
return {
from: pos,
list: [
{
text: "disp1",
render: function (el, self, data) {
;
}
},
{
className: "class2",
displayText: "disp2",
from: pos,
to: pos,
text: "sometext"
}
],
to: pos
};
});
+62
View File
@@ -0,0 +1,62 @@
// Type definitions for CodeMirror
// Project: https://github.com/marijnh/CodeMirror
// Definitions by: jacqt <https://github.com/jacqt>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module CodeMirror {
var commands : any;
/** Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
a hinting functions (the hint option), which is a function that take an editor instance and options object,
and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */
function showHint (cm: CodeMirror.Doc, hinter?: (doc : CodeMirror.Doc) => Hints, options?: IShowHintOptions) : void;
interface Hints {
from: Position;
to: Position;
list: Hint[] | string[];
}
/** Interface used by showHint.js Codemirror add-on
When completions aren't simple strings, they should be objects with the following properties: */
interface Hint {
text: string;
className?: string;
displayText?: string;
from?: Position;
render?: (element: any, self: any, data: any) => void;
to?: Position;
}
interface Editor {
/** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */
on(eventName: string, handler: (doc: CodeMirror.Doc, event : any ) => void ): void;
off(eventName: string, handler: (doc: CodeMirror.Doc, event : any) => void ): void;
}
/** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/
interface Doc {
state: any;
showHint: (options: IShowHintOptions) => void;
}
interface IShowHintOptions {
completeSingle: boolean;
hint: (doc : CodeMirror.Doc) => Hints;
}
/** The Handle used to interact with the autocomplete dialog box.*/
interface Handle {
moveFocus(n: number, avoidWrap: boolean): void;
setFocus(n: number): void;
menuSize(): number;
length: number;
close(): void;
pick(): void;
data: any;
}
}
+15
View File
@@ -0,0 +1,15 @@
/// <reference path="gulp-espower.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import espower = require('gulp-espower');
import * as gulp from 'gulp';
gulp.src('src/*.coffee')
.pipe(espower())
.pipe(gulp.dest('out'));
gulp.src('src/*.coffee')
.pipe(espower({ patterns: ['assert(value, [message])'] }))
.pipe(gulp.dest('out'));
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for gulp-espower
// Project: https://github.com/power-assert-js/gulp-espower
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "gulp-espower" {
namespace espower {
interface Espower {
/**
* @param options Target patterns for power assert feature instrumentation.
*/
(options?: Options): NodeJS.ReadWriteStream;
}
interface Options {
patterns: string[];
}
}
var espower: espower.Espower;
export = espower;
}
+4 -4
View File
@@ -7,7 +7,7 @@ function testFramework(): NodeJS.ReadWriteStream {
return null;
}
gulp.task('test', function (cb) {
gulp.task('test', function (cb: Function) {
gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul()) // Covering files
.pipe(gulp.dest('test-tmp/'))
@@ -19,7 +19,7 @@ gulp.task('test', function (cb) {
});
});
gulp.task('test', function (cb) {
gulp.task('test', function (cb: Function) {
gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul({includeUntested: true})) // Covering files
.pipe(istanbul.hookRequire())
@@ -31,7 +31,7 @@ gulp.task('test', function (cb) {
});
});
gulp.task('test', function (cb) {
gulp.task('test', function (cb: Function) {
gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul({includeUntested: true})) // Covering files
.pipe(istanbul.hookRequire())
@@ -42,4 +42,4 @@ gulp.task('test', function (cb) {
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) //
.on('end', cb);
});
});
});
+4 -2
View File
@@ -7,6 +7,8 @@
/// <reference path="../gulp/gulp.d.ts" />
declare module 'gulp-protractor' {
import gulp = require('gulp');
interface IOptions {
configFile?: string;
args?: Array<string>;
@@ -16,8 +18,8 @@ declare module 'gulp-protractor' {
interface IGulpProtractor {
getProtractorDir(): string;
protractor(options?: IOptions): NodeJS.ReadWriteStream;
webdriver_standalone: gulp.ITaskCallback;
webdriver_update: gulp.ITaskCallback;
webdriver_standalone: gulp.TaskCallback;
webdriver_update: gulp.TaskCallback;
}
var protractor: IGulpProtractor;
+1 -1
View File
@@ -9,7 +9,7 @@ gulp.task("tsd", () => {
.pipe(tsd());
});
gulp.task("tsd:options", callback => {
gulp.task("tsd:options", (callback: any) => {
tsd({
command: "reinstall",
config: "tsd.json"
+2 -1
View File
@@ -7,6 +7,7 @@
/// <reference path="../gulp/gulp.d.ts" />
declare module "gulp-tsd" {
import gulp = require('gulp');
interface IOptions {
command?: string;
@@ -15,7 +16,7 @@ declare module "gulp-tsd" {
opts?: Object;
}
function tsd(opts?: IOptions, callback?: gulp.ITaskCallback): NodeJS.ReadWriteStream;
function tsd(opts?: IOptions, callback?: gulp.TaskCallback): NodeJS.ReadWriteStream;
export = tsd;
}
+1 -1
View File
@@ -10,7 +10,7 @@ gulp.task('stream', () =>
.pipe(gulp.dest('build'))
);
gulp.task('callback', (cb) =>
gulp.task('callback', (cb: Function) =>
watch('css/**/*.css', () =>
gulp.src('css/**/*.css')
.pipe(watch('css/**/*.css'))
+5 -2
View File
@@ -4,8 +4,8 @@
import gulp = require("gulp");
import browserSync = require("browser-sync");
var typescript: IGulpPlugin = null; // this would be the TypeScript compiler
var jasmine: IGulpPlugin = null; // this would be the jasmine test runner
var typescript: gulp.GulpPlugin = null; // this would be the TypeScript compiler
var jasmine: gulp.GulpPlugin = null; // this would be the jasmine test runner
gulp.task('compile', function()
{
@@ -31,6 +31,7 @@ gulp.task('test', ['compile', 'compile2'], function()
gulp.task('default', ['compile', 'test']);
var opts = {};
gulp.watch('*.html', 'compile');
@@ -66,3 +67,5 @@ gulp.task('serve', ['compile'], () => {
var browser = browserSync.create();
gulp.watch(['*.html', '*.ts'], ['compile', browser.reload]);
});
gulp.start('test', 'compile');
+280 -261
View File
@@ -4,268 +4,287 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module gulp {
/**
* Options to pass to node-glob through glob-stream.
* Specifies two options in addition to those used by node-glob:
* https://github.com/isaacs/node-glob#options
*/
interface ISrcOptions {
/**
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
* and not read the file at all.
* Default: <code>true</code>.
*/
read?: boolean;
/**
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
* This is useful when working with large files.
* Note: Plugins might not implement support for streams.
* Default: <code>true</code>.
*/
buffer?: boolean;
/**
* The base path of a glob.
*
* Default is everything before a glob starts.
*/
base?: string;
/**
* The current working directory in which to search.
* Defaults to process.cwd().
*/
cwd?: string;
/**
* The place where patterns starting with / will be mounted onto.
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
*/
root?: string;
/**
* Include .dot files in normal matches and globstar matches.
* Note that an explicit dot in a portion of the pattern will always match dot files.
*/
dot?: boolean;
/**
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
* filesystem path is returned. Set this flag to disable that behavior.
*/
nomount?: boolean;
/**
* Add a / character to directory matches. Note that this requires additional stat calls.
*/
mark?: boolean;
/**
* Don't sort the results.
*/
nosort?: boolean;
/**
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
* level sooner in the case of cyclical symbolic links.
*/
stat?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
* Set the silent option to true to suppress these warnings.
*/
silent?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
* search of other matches. Set the strict option to raise an error in these cases.
*/
strict?: boolean;
/**
* See cache property above. Pass in a previously generated cache object to save some fs calls.
*/
cache?: boolean;
/**
* A cache of results of filesystem information, to prevent unnecessary stat calls.
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
* options object of another, if you know that the filesystem will not change between calls.
*/
statCache?: boolean;
/**
* Perform a synchronous glob search.
*/
sync?: boolean;
/**
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
*/
nounique?: boolean;
/**
* Set to never return an empty set, instead returning a set containing the pattern itself.
* This is the default in glob(3).
*/
nonull?: boolean;
/**
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
*/
nocase?: boolean;
/**
* Set to enable debug logging in minimatch and glob.
*/
debug?: boolean;
/**
* Set to enable debug logging in glob, but not minimatch.
*/
globDebug?: boolean;
}
interface IDestOptions {
/**
* The output folder. Only has an effect if provided output folder is relative.
* Default: process.cwd()
*/
cwd?: string;
/**
* Octal permission string specifying mode for any folders that need to be created for output folder.
* Default: 0777.
*/
mode?: string;
}
/**
* Options that are passed to <code>gaze</code>.
* https://github.com/shama/gaze
*/
interface IWatchOptions {
/** Interval to pass to fs.watchFile. */
interval?: number;
/** Delay for events called in succession for the same file/event. */
debounceDelay?: number;
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
mode?: string;
/** The current working directory to base file patterns from. Default is process.cwd().. */
cwd?: string;
}
interface IWatchEvent {
/** The type of change that occurred, either added, changed or deleted. */
type: string;
/** The path to the file that triggered the event. */
path: string;
}
/**
* Callback to be called on each watched file change.
*/
interface IWatchCallback {
(event:IWatchEvent): void;
}
interface ITaskCallback {
/**
* Defines a task.
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
*/
(cb?:(err?:any)=>void): any;
}
interface EventEmitter {
any: any;
}
interface Gulp {
/**
* Define a task.
*
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
*/
task(name:string, fn:ITaskCallback): any;
/**
* Define a task.
*
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
* @param dep an array of tasks to be executed and completed before your task will run.
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
*/
task(name:string, dep:string[], fn?:ITaskCallback): any;
/**
* Takes a glob and represents a file structure. Can be piped to plugins.
* @param glob a glob string, using node-glob syntax
* @param opt an optional option object
*/
src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream;
/**
* Takes a glob and represents a file structure. Can be piped to plugins.
* @param glob an array of glob strings, using node-glob syntax
* @param opt an optional option object
*/
src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream;
/**
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
* Folders that don't exist will be created.
*
* @param outFolder the path (output folder) to write files to.
* @param opt
*/
dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream;
/**
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
* Folders that don't exist will be created.
*
* @param outFolder a function that converts a vinyl File instance into an output path
* @param opt
*/
dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream;
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param opt options, that are passed to the gaze library.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with gulp.task().
*/
watch(glob:string, fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string, fn:(IWatchCallback|string)[]): EventEmitter;
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
watch(glob:string[], fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string[], fn:(IWatchCallback|string)[]): EventEmitter;
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
}
}
/// <reference path="../orchestrator/orchestrator.d.ts" />
declare module "gulp" {
var _tmp:gulp.Gulp;
export = _tmp;
}
import Orchestrator = require("orchestrator");
interface IGulpPlugin {
(...args: any[]): NodeJS.ReadWriteStream;
namespace gulp {
interface Gulp extends Orchestrator {
/**
* Define a task
* @param name The name of the task.
* @param deps An array of task names to be executed and completed before your task will run.
* @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete:
* <ul>
* <li>Take in a callback</li>
* <li>Return a stream or a promise</li>
* </ul>
*/
task: Orchestrator.AddMethod;
/**
* Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins.
* @param glob Glob or array of globs to read.
* @param opt Options to pass to node-glob through glob-stream.
*/
src: SrcMethod;
/**
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
* Folders that don't exist will be created.
*
* @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance.
* @param opt
*/
dest: DestMethod;
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param opt options, that are passed to the gaze library.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
*/
watch: WatchMethod;
}
interface GulpPlugin {
(...args: any[]): NodeJS.ReadWriteStream;
}
interface WatchMethod {
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
*/
(glob: string|string[], fn: (WatchCallback|string)): NodeJS.EventEmitter;
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
*/
(glob: string|string[], fn: (WatchCallback|string)[]): NodeJS.EventEmitter;
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param opt options, that are passed to the gaze library.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
*/
(glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)): NodeJS.EventEmitter;
/**
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
*
* @param glob a single glob or array of globs that indicate which files to watch for changes.
* @param opt options, that are passed to the gaze library.
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
*/
(glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)[]): NodeJS.EventEmitter;
}
interface DestMethod {
/**
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
* Folders that don't exist will be created.
*
* @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance.
* @param opt
*/
(outFolder: string|((file: string) => string), opt?: DestOptions): NodeJS.ReadWriteStream;
}
interface SrcMethod {
/**
* Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins.
* @param glob Glob or array of globs to read.
* @param opt Options to pass to node-glob through glob-stream.
*/
(glob: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream;
}
/**
* Options to pass to node-glob through glob-stream.
* Specifies two options in addition to those used by node-glob:
* https://github.com/isaacs/node-glob#options
*/
interface SrcOptions {
/**
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
* and not read the file at all.
* Default: <code>true</code>.
*/
read?: boolean;
/**
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
* This is useful when working with large files.
* Note: Plugins might not implement support for streams.
* Default: <code>true</code>.
*/
buffer?: boolean;
/**
* The base path of a glob.
*
* Default is everything before a glob starts.
*/
base?: string;
/**
* The current working directory in which to search.
* Defaults to process.cwd().
*/
cwd?: string;
/**
* The place where patterns starting with / will be mounted onto.
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
*/
root?: string;
/**
* Include .dot files in normal matches and globstar matches.
* Note that an explicit dot in a portion of the pattern will always match dot files.
*/
dot?: boolean;
/**
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
* filesystem path is returned. Set this flag to disable that behavior.
*/
nomount?: boolean;
/**
* Add a / character to directory matches. Note that this requires additional stat calls.
*/
mark?: boolean;
/**
* Don't sort the results.
*/
nosort?: boolean;
/**
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
* level sooner in the case of cyclical symbolic links.
*/
stat?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
* Set the silent option to true to suppress these warnings.
*/
silent?: boolean;
/**
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
* search of other matches. Set the strict option to raise an error in these cases.
*/
strict?: boolean;
/**
* See cache property above. Pass in a previously generated cache object to save some fs calls.
*/
cache?: boolean;
/**
* A cache of results of filesystem information, to prevent unnecessary stat calls.
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
* options object of another, if you know that the filesystem will not change between calls.
*/
statCache?: boolean;
/**
* Perform a synchronous glob search.
*/
sync?: boolean;
/**
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
*/
nounique?: boolean;
/**
* Set to never return an empty set, instead returning a set containing the pattern itself.
* This is the default in glob(3).
*/
nonull?: boolean;
/**
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
*/
nocase?: boolean;
/**
* Set to enable debug logging in minimatch and glob.
*/
debug?: boolean;
/**
* Set to enable debug logging in glob, but not minimatch.
*/
globDebug?: boolean;
}
interface DestOptions {
/**
* The output folder. Only has an effect if provided output folder is relative.
* Default: process.cwd()
*/
cwd?: string;
/**
* Octal permission string specifying mode for any folders that need to be created for output folder.
* Default: 0777.
*/
mode?: string;
}
/**
* Options that are passed to <code>gaze</code>.
* https://github.com/shama/gaze
*/
interface WatchOptions {
/** Interval to pass to fs.watchFile. */
interval?: number;
/** Delay for events called in succession for the same file/event. */
debounceDelay?: number;
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
mode?: string;
/** The current working directory to base file patterns from. Default is process.cwd().. */
cwd?: string;
}
interface WatchEvent {
/** The type of change that occurred, either added, changed or deleted. */
type: string;
/** The path to the file that triggered the event. */
path: string;
}
/**
* Callback to be called on each watched file change.
*/
interface WatchCallback {
(event: WatchEvent): void;
}
interface TaskCallback {
/**
* Defines a task.
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
*/
(cb?: (err?: any) => void): any;
}
}
var gulp: gulp.Gulp;
export = gulp;
}
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="highcharts-ng.d.ts" />
/// <reference path="../angularjs/angular.d.ts" />
var app = angular.module('app', ['highcharts-ng']);
class AppController {
chartConfig: HighChartsNGConfig = {
options: {
chart: {
type: 'bar'
},
tooltip: {
style: {
padding: 10,
fontWeight: 'bold'
}
},
credits: {
enabled: false
},
plotOptions: {}
},
series: [{
data: [10, 15, 12, 8, 7]
}],
title: {
text: 'My Awesome Chart'
},
loading: true
};
constructor($timeout: ng.ITimeoutService) {
var vm = this;
$timeout(function() {
//Some async action
vm.chartConfig.loading = false;
});
}
}
app.controller("AppController", AppController);
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for highcharts-ng 0.0.8
// Project: https://github.com/pablojim/highcharts-ng
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../highcharts/highcharts.d.ts" />
interface HighChartsNGConfig {
options: HighchartsChartOptions;
//The below properties are watched separately for changes.
//Series object (optional) - a list of series using normal highcharts series options.
series?: number[]|[number, number][]| HighchartsDataPoint[];
//Title configuration (optional)
title?: {
text?: string;
};
//Boolean to control showng loading status on chart (optional)
//Could be a string if you want to show specific loading text.
loading?: boolean;
//Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled.
//properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum
xAxis?: {
currentMin?: number;
currentMax?: number;
title?: { text?: string }
},
//Whether to use HighStocks instead of HighCharts (optional). Defaults to false.
useHighStocks?: boolean;
//size (optional) if left out the chart will default to size of the div or something sensible.
size?: {
width?: number;
height?: number;
};
//function (optional) - setup some logic for the chart
func?: (chart: HighchartsChartObject) => void;
}
//Instantiated Chart
interface HighChartsNGChart extends HighChartsNGConfig {
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
getHighcharts(): HighchartsChartObject;
}
+14 -5
View File
@@ -1207,6 +1207,12 @@ result = <boolean>_(1).isArray();
result = <boolean>_<any>([]).isArray();
result = <boolean>_({}).isArray();
// _.isBoolean
result = <boolean>_.isBoolean(any);
result = <boolean>_(1).isBoolean();
result = <boolean>_<any>([]).isBoolean();
result = <boolean>_({}).isBoolean();
// _.isDate
result = <boolean>_.isDate(any);
result = <boolean>_(42).isDate();
@@ -1260,6 +1266,12 @@ result = <boolean>_(undefined).isNaN();
result = <boolean>_.isNative(Array.prototype.push);
result = <boolean>_(Array.prototype.push).isNative();
// _.isNull
result = <boolean>_.isNull(any);
result = <boolean>_(1).isNull();
result = <boolean>_<any>([]).isNull();
result = <boolean>_({}).isNull();
// _.isNumber
result = <boolean>_.isNumber(any);
result = <boolean>_(1).isNumber();
@@ -1473,8 +1485,6 @@ interface FirstSecond {
}
result = <FirstSecond>_.invert({ 'first': 'moe', 'second': 'larry' });
result = <boolean>_.isBoolean(null);
result = <boolean>_.isElement(document.body);
// _.isEqual (alias: _.eq)
@@ -1502,9 +1512,6 @@ result = <boolean>_(testEqArray).isEqual(testEqOtherArray, testEqCustomizerFn);
result = <boolean>_.eq(testEqArray, testEqOtherArray, testEqCustomizerFn);
result = <boolean>_(testEqArray).eq(testEqOtherArray, testEqCustomizerFn);
result = <boolean>_.isNull(null);
result = <boolean>_.isNull(undefined);
result = <boolean>_.isObject({});
result = <boolean>_.isObject([1, 2, 3]);
result = <boolean>_.isObject(1);
@@ -1755,7 +1762,9 @@ result = <string>_.uniqueId();
result = <string>_.camelCase('Foo Bar');
result = <string>_('Foo Bar').camelCase();
// _.capitalize
result = <string>_.capitalize('fred');
result = <string>_('fred').capitalize();
// _.deburr
result = <string>_.deburr('déjà vu');
+43 -21
View File
@@ -6196,6 +6196,23 @@ declare module _ {
isArray(): boolean;
}
//_.isBoolean
interface LoDashStatic {
/**
* Checks if value is classified as a boolean primitive or object.
* @param value The value to check.
* @return Returns true if value is correctly classified, else false.
**/
isBoolean(value?: any): boolean;
}
interface LoDashWrapperBase<T, TWrapper> {
/**
* @see _.isBoolean
*/
isBoolean(): boolean;
}
//_.isDate
interface LoDashStatic {
/**
@@ -6346,6 +6363,23 @@ declare module _ {
isNative(): boolean;
}
//_.isNull
interface LoDashStatic {
/**
* Checks if value is null.
* @param value The value to check.
* @return Returns true if value is null, else false.
**/
isNull(value?: any): boolean;
}
interface LoDashWrapperBase<T, TWrapper> {
/**
* see _.isNull
*/
isNull(): boolean;
}
//_.isNumber
interface LoDashStatic {
/**
@@ -7063,16 +7097,6 @@ declare module _ {
invert(object: any): any;
}
//_.isBoolean
interface LoDashStatic {
/**
* Checks if value is a boolean value.
* @param value The value to check.
* @return True if the value is a boolean value, else false.
**/
isBoolean(value?: any): boolean;
}
//_.isElement
interface LoDashStatic {
/**
@@ -7163,16 +7187,6 @@ declare module _ {
thisArg?: any): boolean;
}
//_.isNull
interface LoDashStatic {
/**
* Checks if value is null.
* @param value The value to check.
* @return True if the value is null, else false.
**/
isNull(value?: any): boolean;
}
//_.isObject
interface LoDashStatic {
/**
@@ -7583,8 +7597,16 @@ declare module _ {
camelCase(): string;
}
//_.capitalize
interface LoDashStatic {
capitalize(str?: string): string;
capitalize(string?: string): string;
}
interface LoDashWrapper<T> {
/**
* @see _.capitalize
*/
capitalize(): string;
}
//_.deburr
+51 -6
View File
@@ -1,18 +1,63 @@
///<reference path='./node-mysql-wrapper.d.ts' />
import wrapper = require("node-mysql-wrapper");
var db = wrapper("mysql://kataras:pass@127.0.0.1/taglub?debug=false&charset=utf8");
var db = wrapper.wrap("mysql://kataras:pass@127.0.0.1/taglub?debug=false&charset=utf8");
class User { //or interface
userId: number;
username: string;
mail: string;
comments: Comment[];
}
interface Comment {
commentId: number;
content: string;
}
db.ready(() => {
db.table("users").on("insert", (parsedResults) => {
var usersDb = db.table<User>("users");
usersDb.findById(16, (_user) => {
console.log("TEST1: \n");
console.log("FOUND USER WITH USERNAME: " + _user.username);
});
/* OR usersDb.findById(18).then(_user=> {
console.log("FOUND USER WITH USERNAME: " + _user.username);
}, (err) => { console.log("ERROR ON FETCHING FINDBY ID: " + err) });
*/
usersDb.find({ userId: 18, comments: { userId: '=' } }, _users=> {
var _user = _users[0];
console.log("TEST2: \n");
console.log(_user.username + " with ");
console.log(_user.comments.length + " comments ");
_user.comments.forEach(_comment=> {
console.log("--------------\n" + _comment.content);
});
});
db.table("users").findAll().then((results) => {
console.dir(results);
usersDb.safeRemove(5620, answer=> {
console.log("TEST 3: \n");
console.log(answer.affectedRows + ' (1) has removed from table: ' + answer.table);
});
db.table("users").find({ userId: 18 }, (results) => {
console.dir(results[0]);
var auser = new User();
auser.username = ' just a username';
auser.mail = ' just an email';
usersDb.save(auser, newUser=> {
console.log("TEST 4: \n");
console.log("NEW USER HAS CREATED WITH NEW USER ID: " + newUser.userId);
});
});
+104 -104
View File
@@ -3,129 +3,129 @@
// Definitions by: Makis Maropoulos <https://github.com/kataras>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path='../mysql/mysql.d.ts' />
///<reference path='./../mysql/mysql.d.ts' />
///<reference path='./../bluebird/bluebird.d.ts' />
declare module "node-mysql-wrapper" {
import Mysql = require("mysql");
import * as Mysql from 'mysql';
import * as Promise from 'bluebird';
import {EventEmitter} from 'events';
function MySQLWrapperBuilder(connection: string | Mysql.IConnection, ...useOnlyTables: string[]): MySQLWrapper;
var EQUAL_TO_PROPERTY_SYMBOL: string;
enum EVENT_TYPES {
INSERT, UPDATE, DELETE, SAVE
interface Map<T> {
[index: string]: T;
}
interface MySQLConnection {
new (connection: string | Mysql.IConnection): MySQLConnection;
class MysqlUtil {
constructor();
static copyObject<T>(object: T): T;
static toObjectProperty(columnKey: string): string;
static toRowProperty(objectKey: string): string;
static forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
static forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
}
create(connectionUri: string): void;
create(connection: Mysql.IConnection): void;
interface ICriteria {
rawCriteriaObject: any;
tables: string[];
noDatabaseProperties: string[];
whereClause: string;
}
class Criteria implements ICriteria {
rawCriteriaObject: any;
tables: string[];
noDatabaseProperties: string[];
whereClause: string;
constructor(rawCriteriaObject: any, tables: string[], noDatabaseProperties: string[], whereClause: string);
}
class CriteriaBuilder<T> {
private _table;
constructor(table: MysqlTable<T>);
build(rawCriteriaObject: any): Criteria;
}
class MysqlConnection extends EventEmitter {
connection: Mysql.IConnection;
eventTypes: string[];
tableNamesToUseOnly: any[];
tables: MysqlTable<any>[];
constructor(connection: string | Mysql.IConnection);
create(connection: string | Mysql.IConnection): void;
attach(connection: Mysql.IConnection): void;
end(callback: () => void): void;
end(callback?: (error: any) => void): void;
destroy(): void;
link<U>(callback?: () => void): Promise<U>;
connect<U>(callback?: () => void): Promise<U>;
useOnly(...useOnlyTables: string[]): void;
fetchDatabaseInfornation<U>(): Promise<U>;
link(readyCallback?: () => void): Promise<void>;
useOnly(...tables: any[]): void;
fetchDatabaseInfornation(): Promise<void>;
escape(val: string): string;
notice(tableWhichCalled: string, queryStr: string, parsedResults: Object[]): void;
fireEvent(tableWhichCalled: string, queryStr: string, parsedResults: Object[]): void;
watch(tableName: string, evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
on(tableName: string, evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
unwatch(tableName: string, evtType: EVENT_TYPES | string, callbackToRemove: () => void): void;
off(tableName: string, evtType: EVENT_TYPES | string, callbackToRemove: () => void): void;
query(mysqlQuery: Mysql.IQueryFunction): void;
table(tableName: string): MySQLTable;
notice(tableWhichCalled: string, queryStr: string, parsedResults: any[]): void;
watch(tableName: string, evtType: any, callback: (parsedResults: any[]) => void): void;
unwatch(tableName: string, evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
table<T>(tableName: string): MysqlTable<T>;
}
interface MySQLTable {
new (tableName: string, connection: MySQLConnection): MySQLTable;
setColumns(columns: string[]): void;
setPrimaryKey(primaryKeyColumnName: string): void;
toString(): string;
model(jsObject: Object): MySQLModel;
watch(evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
on(evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
unwatch(evtType: EVENT_TYPES|string, callbackToRemove: () => void): void;
off(evtType: EVENT_TYPES|string, callbackToRemove: () => void): void;
///START DYNAMIC METHODS FOR TABLES CANNOT BE PRE-DEFINED WITH DYNAMIC WAY, YET, SO:
find<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
save<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
remove<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
delete<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
safeDelete<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
///END
findAll<U>(callback?: (results: Object[]) => void): Promise<U>;
extend(functionName: string, functionToBeSupported: () => any): void;
class MysqlTable<T> {
private _name;
private _connection;
private _columns;
private _primaryKey;
private _criteriaBuilder;
constructor(tableName: string, connection: MysqlConnection);
columns: string[];
primaryKey: string;
connection: MysqlConnection;
name: string;
on(evtType: string, callback: (parsedResults: any[]) => void): void;
off(evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
has(extendedFunctionName: string): boolean;
extend(functionName: string, theFunction: (...args: any[]) => any): void;
objectFromRow(row: any): any;
rowFromObject(obj: any): any;
getRowAsArray(jsObject: any): Array<any>;
getPrimaryKeyValue(jsObject: any): number | string;
parseQueryResult(result: any, criteria: ICriteria): Promise<any>;
find(criteriaRawJsObject: any, callback?: (_results: T[]) => any): Promise<T[]>;
findById(id: number | string, callback?: (result: T) => any): Promise<T>;
findAll(callback?: (_results: T[]) => any): Promise<T[]>;
save(criteriaRawJsObject: any, callback?: (_result: any) => any): Promise<any>;
safeRemove(id: number | string, callback?: (_result: {
affectedRows: number;
table: string;
}) => any): Promise<{
affectedRows: number;
table: string;
}>;
remove(criteriaRawJsObject: any, callback?: (_result: {
affectedRows: number;
table: string;
}) => any): Promise<{
affectedRows: number;
table: string;
}>;
}
interface MySQLModel {
new (table: MySQLTable, jsObject: Object): MySQLModel;
toObjectProperty(columnKey: string): string;
toRowProperty(objectKey: string): string;
create(jsObject: Object): MySQLModel;
reUse(jsObject: Object): MySQLModel;
toRow(): void;
getRawObject(): Object;
parseTable<U>(mysqlTableToSearch: String, parentObject: Object): Promise<U>;
parseResult<U>(result: Object, tablesToSearch: string[]): Promise<U>;
find<U>(parentObj?: Object): Promise<U>;
findAll<U>(): Promise<U>;
save<U>(): Promise<U>;
safeDelete<U>(): Promise<U>;
remove<U>(): Promise<U>;
delete<U>(): Promise<U>;
}
interface MySQLWrapper {
new (connection?: MySQLConnection): MySQLWrapper;
setConnection(connection: MySQLConnection): void;
useOnly(...useOnlyTables: string[]): void;
has(tableName: string): boolean;
has(tableName: string, methodName: string): boolean;
class MysqlWrapper {
connection: MysqlConnection;
readyListenerCallbacks: Function[];
constructor(connection?: MysqlConnection);
static when(..._promises: Promise<any>[]): Promise<any>;
setConnection(connection: MysqlConnection): void;
useOnly(...useTables: any[]): void;
has(tableName: string, functionName?: string): boolean;
ready(callback: () => void): void;
table<T>(tableName: string): MysqlTable<T>;
noticeReady(): void;
removeReadyListener(callback: () => any): void;
query: Mysql.IQueryFunction;
removeReadyListener(callback: () => void): void;
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
destroy(): void;
end(callback?: () => void): void;
when<U>(): Promise<U[]>;
///START: WE CANNOT PRE-DEFINE THE DYNAMIC TABLES INTO PROPERTIES, SO WE USE INDEX(STRING-TABLENAME) TO GET A TABLE
table(tableName: string): MySQLTable;
///END
end(maybeAcallbackError: (err: any) => void): void;
}
export = MySQLWrapperBuilder;
function wrap(mysqlUrlOrObjectOrMysqlAlreadyConnection: Mysql.IConnection | string, ...useTables: any[]): MysqlWrapper;
}
+40
View File
@@ -0,0 +1,40 @@
// Test file for offline-js.
/// <reference path="offline-js.d.ts" />
Offline.options = {
checkOnLoad: false,
interceptRequests: true,
checks: {
xhr: { url: '/connection-test' },
image: { url: 'my-image.gif' },
active: 'image'
},
reconnect: {
initialDelay: 3,
delay: 60
},
requests: true,
game: false
};
Offline.check();
Offline.state;
var handler = () => { },
context = {};
Offline.on("up", handler, context);
Offline.on("down", handler, context);
Offline.on("confirmed-up", handler, context);
Offline.on("confirmed-down", handler, context);
Offline.on("checking", handler, context);
Offline.on("reconnect:started", handler, context);
Offline.on("reconnect:stopped", handler, context);
Offline.on("reconnect:tick", handler, context);
Offline.on("reconnect:connecting", handler, context);
Offline.on("reconnect:failure", handler, context);
Offline.on("requests:flush", handler, context);
Offline.on("requests:hold", handler, context);
Offline.off("up", handler);
+64
View File
@@ -0,0 +1,64 @@
// Type definitions for Offline 0.7.14
// Project: https://github.com/HubSpot/offline
// Definitions by: Chris Wrench <https://github.com/cgwrench>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var Offline: {
options: OfflineOptions;
check: () => void;
state: string;
on(event: "up", handler: (e: Event) => any, context?: any): void;
on(event: "down", handler: (e: Event) => any, context?: any): void;
on(event: "confirmed-up", handler: (e: Event) => any, context?: any): void;
on(event: "confirmed-down", handler: (e: Event) => any, context?: any): void;
on(event: "checking", handler: (e: Event) => any, context?: any): void;
on(event: "reconnect:started", handler: (e: Event) => any, context?: any): void;
on(event: "reconnect:stopped", handler: (e: Event) => any, context?: any): void;
on(event: "reconnect:tick", handler: (e: Event) => any, context?: any): void;
on(event: "reconnect:connecting", handler: (e: Event) => any, context?: any): void;
on(event: "reconnect:failure", handler: (e: Event) => any, context?: any): void;
on(event: "requests:flush", handler: (e: Event) => any, context?: any): void;
on(event: "requests:hold", handler: (e: Event) => any, context?: any): void;
on(event: string, handler: (e: Event) => any, context?: any): void;
off(event: "up", handler?: (e: Event) => any): void;
off(event: "down", handler?: (e: Event) => any): void;
off(event: "confirmed-up", handler?: (e: Event) => any): void;
off(event: "confirmed-down", handler?: (e: Event) => any): void;
off(event: "checking", handler?: (e: Event) => any): void;
off(event: "reconnect:started", handler?: (e: Event) => any): void;
off(event: "reconnect:stopped", handler?: (e: Event) => any): void;
off(event: "reconnect:tick", handler?: (e: Event) => any): void;
off(event: "reconnect:connecting", handler?: (e: Event) => any): void;
off(event: "reconnect:failure", handler?: (e: Event) => any): void;
off(event: "requests:flush", handler?: (e: Event) => any): void;
off(event: "requests:hold", handler?: (e: Event) => any): void;
off(event: string, handler?: (e: Event) => any): void;
};
interface OfflineOptions {
// TODO Should these types be `boolean|Function`?
// The project documentation is not clear here.
checkOnLoad?: boolean;
interceptRequests?: boolean;
requests?: boolean;
game?: boolean;
checks?: OfflineChecks;
reconnect: {
initialDelay: number;
delay: number;
};
}
interface OfflineChecks {
// TODO "xhr" and "image" probably have different options.
// However, this is not stated in the project documentation.
xhr?: OfflineCheck;
image?: OfflineCheck;
active?: string;
}
interface OfflineCheck {
url: string;
}
+8
View File
@@ -33,6 +33,7 @@ var featureFormat: ol.format.Feature;
var geometry: ol.geom.Geometry;
var loadingstrategy: ol.LoadingStrategy;
var tilegrid: ol.tilegrid.TileGrid;
var vector: ol.source.Vector;
//
// ol.Attribution
@@ -112,6 +113,13 @@ geometryResult.getClosestPoint(coordinate, coordinate);
extent = geometryResult.getExtent();
geometryResult.getExtent(extent);
//
// ol.source
//
vector = new ol.source.Vector({
features: [feature]
});
//
// ol.Feature
//
+227 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for OpenLayers v3.6.0
// Type definitions for OpenLayers v3.6.0
// Project: http://openlayers.org/
// Definitions by: Wouter Goedhart <https://github.com/woutergd>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -88,6 +88,21 @@ declare module olx {
targetSize?: number;
}
/**
* Object literal with config options for the map logo.
*/
interface LogoOptions {
/**
* Link url for the logo. Will be followed when the logo is clicked.
*/
href: string;
/**
* Image src for the logo
*/
src: string;
}
interface MapOptions {
/** Controls initially added to the map. If not specified, ol.control.defaults() is used. */
@@ -382,6 +397,21 @@ declare module olx {
}
}
module interaction {
interface DefaultsOptions {
altShiftDragRotate?: boolean;
doubleClickZoom?: boolean;
keyboard?: boolean;
mouseWheelZoom?: boolean;
shiftDragZoom?: boolean;
dragPan?: boolean;
pinchRotate?: boolean;
pinchZoom?: boolean;
zoomDelta?: number;
zoomDuration?: number;
}
}
module layer {
interface BaseOptions {
@@ -527,6 +557,97 @@ declare module olx {
}
}
module source {
interface VectorOptions {
/**
* Attributions.
*/
attributions?: Array<ol.Attribution>;
/**
* Features. If provided as {@link ol.Collection}, the features in the source
* and the collection will stay in sync.
*/
features?: Array<ol.Feature> | ol.Collection<ol.Feature>;
/**
* The feature format used by the XHR feature loader when `url` is set.
* Required if `url` is set, otherwise ignored. Default is `undefined`.
*/
format?: ol.format.Feature;
/**
* The loader function used to load features, from a remote source for example.
* Note that the source will create and use an XHR feature loader when `url` is
* set.
*/
loader?: ol.FeatureLoader;
/**
* Logo.
*/
logo?: string | olx.LogoOptions;
/**
* The loading strategy to use. By default an {@link ol.loadingstrategy.all}
* strategy is used, a one-off strategy which loads all features at once.
*/
strategy?: ol.LoadingStrategy;
/**
* Setting this option instructs the source to use an XHR loader (see
* {@link ol.featureloader.xhr}) and an {@link ol.loadingstrategy.all} for a
* one-off download of all features from that URL.
* Requires `format` to be set as well.
*/
url?: string;
/**
* By default, an RTree is used as spatial index. When features are removed and
* added frequently, and the total number of features is low, setting this to
* `false` may improve performance.
*/
useSpatialIndex?: boolean;
/**
* Wrap the world horizontally. Default is `true`. For vector editing across the
* -180° and 180° meridians to work properly, this should be set to `false`. The
* resulting geometry coordinates will then exceed the world bounds.
*/
wrapX?: boolean;
}
}
module style {
interface FillOptions {
color?: ol.Color | string;
}
interface StyleOptions {
geometry?: string | ol.geom.Geometry | ol.style.GeometryFunction;
fill?: ol.style.Fill;
image?: ol.style.Image;
stroke?: ol.style.Stroke;
text?: ol.style.Text;
zIndex?: number;
}
interface TextOptions {
font?: string;
offsetX?: number;
offsetY?: number;
scale?: number;
rotation?: number;
text?: string;
textAlign?: string;
textBaseline?: string;
fill?: ol.style.Fill;
stroke?: ol.style.Stroke;
}
}
module tilegrid {
interface TileGridOptions {
@@ -2551,13 +2672,16 @@ declare module ol {
class MultiPolygon {
}
class Point {
class Point extends SimpleGeometry {
constructor(coordinates: ol.Coordinate, layout?: geom.GeometryLayout);
getCoordinates(): ol.Coordinate;
setCoordinates(coordinates: ol.Coordinate, opt?: geom.GeometryLayout): void;
}
class Polygon {
}
class SimpleGeometry {
class SimpleGeometry extends Geometry {
}
}
@@ -2625,6 +2749,8 @@ declare module ol {
class Snap {
}
function defaults(opts: olx.interaction.DefaultsOptions): ol.Collection<ol.interaction.Interaction>;
}
module layer {
@@ -3155,6 +3281,14 @@ declare module ol {
}
class Vector {
constructor(opts: olx.source.VectorOptions)
/**
* Get the extent of the features currently in the source.
*/
getExtent(): ol.Extent;
getFeaturesInExtent(extent: ol.Extent): ol.Feature[];
}
class VectorEvent {
@@ -3187,7 +3321,21 @@ declare module ol {
class Circle {
}
/**
* Set fill style for vector features.
*/
class Fill {
constructor(opt_options?: olx.style.FillOptions);
getColor(): ol.Color | string;
/**
* Set the color.
*/
setColor(color: ol.Color | string): void;
getChecksum(): string;
}
class Icon {
@@ -3196,6 +3344,10 @@ declare module ol {
class Image {
}
interface GeometryFunction {
(feature: Feature): ol.geom.Geometry
}
class RegularShape {
}
@@ -3203,10 +3355,82 @@ declare module ol {
constructor();
}
/**
* Container for vector feature rendering styles. Any changes made to the style
* or its children through `set*()` methods will not take effect until the
* feature, layer or FeatureOverlay that uses the style is re-rendered.
*/
class Style {
constructor(opts: olx.style.StyleOptions);
}
/**
* Set text style for vector features.
*/
class Text {
constructor(opt?: olx.style.TextOptions);
getFont(): string;
getOffsetX(): number;
getOffsetY(): number;
getFill(): Fill;
getRotation(): number;
getScale(): number;
getStroke(): Stroke;
getText(): string;
getTextAlign(): string;
getTextBaseline(): string;
/**
* Set the font.
*/
setFont(font: string): void;
/**
* Set the x offset.
*/
setOffsetX(offsetX: number): void;
/**
* Set the y offset.
*/
setOffsetY(offsetY: number): void;
/**
* Set the fill.
*/
setFill(fill: Fill): void;
/**
* Set the rotation.
*/
setRotation(rotation: number): void;
/**
* Set the scale.
*/
setScale(scale: number): void;
/**
* Set the stroke.
*
*/
setStroke(stroke: Stroke): void;
/**
* Set the text.
*/
setText(text: string): void;
/**
* Set the text alignment.
*/
setTextAlign(textAlign: string): void;
/**
* Set the text baseline.
*/
setTextBaseline(textBaseline: string): void;
}
/**
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="./os-locale.d.ts" />
import osLocale, { sync } from 'os-locale';
osLocale((err: any, locale: string) => {
});
var locale: string = sync();
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for os-locale 1.2.1
// Project: https://github.com/sindresorhus/os-locale
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "os-locale" {
function osLocale(cb: (err: any, locale: string) => void): void;
function osLocaleSync(): string;
export { osLocaleSync as sync };
export default osLocale;
}
+1 -1
View File
@@ -5,7 +5,7 @@ import gulp = require("gulp");
import tmp = require("run-sequence");
var runSequence = tmp.use(gulp);
gulp.task("run-sequence", callback => {
gulp.task("run-sequence", (callback: any) => {
runSequence("task1",
["task2", "task3"],
"taks4",
+2 -1
View File
@@ -7,9 +7,10 @@
/// <reference path="../gulp/gulp.d.ts" />
declare module "run-sequence" {
import gulp = require('gulp');
interface IRunSequence {
(...streams: (string | string[] | gulp.ITaskCallback)[]): NodeJS.ReadWriteStream;
(...streams: (string | string[] | gulp.TaskCallback)[]): NodeJS.ReadWriteStream;
use(gulp: gulp.Gulp): IRunSequence;
}
+2 -1
View File
@@ -56,6 +56,7 @@ $("#e6").select2({
ajax: {
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
cache: false,
data: function (term, page) {
return {
q: term,
@@ -195,4 +196,4 @@ $("#e8").select2("enable", false);
$("#e8").select2("readonly", false);
$("#e8").select2('container');
$("#e8").select2('onSortStart');
$("#e8").select2('onSortEnd');
$("#e8").select2('onSortEnd');
+1
View File
@@ -26,6 +26,7 @@ interface Select2AjaxOptions {
url?: any;
dataType?: string;
quietMillis?: number;
cache?: boolean;
data?: (term: string, page: number, context: any) => any;
results?: (term: any, page: number, context: any) => any;
}
@@ -47,11 +47,14 @@ interface GTaskAttributes {
revision? : number;
name? : string;
}
interface GTaskInstance extends Sequelize.Instance<GTaskInstance, GTaskAttributes> {}
interface GTaskInstance extends Sequelize.Instance<GTaskInstance, GTaskAttributes> {
upRevision(): void;
}
var GTask = s.define<GTaskInstance, GTaskAttributes>( 'task', { revision : Sequelize.INTEGER, name : Sequelize.STRING });
GUser.hasMany(GTask);
GTask.create({ revision: 1, name: 'test' }).then( (gtask) => gtask.upRevision() );
//
+188 -188
View File
@@ -256,13 +256,13 @@ declare module "sequelize" {
* user.getProfilePicture() // gets you only the profile picture
*
* User.findAll({
* where: ...,
* include: [
* { model: Picture }, // load all pictures
* { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be
* the exact same as the one in the association
* ]
* })
* where: ...,
* include: [
* { model: Picture }, // load all pictures
* { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be
* the exact same as the one in the association
* ]
* })
* ```
* To get full control over the foreign key column added by sequelize, you can use the `foreignKey` option. It
* can either be a string, that specifies the name, or and object type definition,
@@ -276,11 +276,11 @@ declare module "sequelize" {
*
* ```js
* User.hasMany(Picture, {
* foreignKey: {
* name: 'uid',
* allowNull: false
* }
* })
* foreignKey: {
* name: 'uid',
* allowNull: false
* }
* })
* ```
*
* This specifies that the `uid` column can not be null. In most cases this will already be covered by the
@@ -293,10 +293,10 @@ declare module "sequelize" {
*
* ```js
* user.getPictures({
* where: {
* format: 'jpg'
* }
* })
* where: {
* format: 'jpg'
* }
* })
* ```
*
* There are several ways to update and add new assoications. Continuing with our example of users and
@@ -371,8 +371,8 @@ declare module "sequelize" {
* started yet:
* ```js
* var UserProjects = sequelize.define('userprojects', {
* started: Sequelize.BOOLEAN
* })
* started: Sequelize.BOOLEAN
* })
* User.hasMany(Project, { through: UserProjects })
* Project.hasMany(User, { through: UserProjects })
* ```
@@ -387,8 +387,8 @@ declare module "sequelize" {
*
* ```js
* p1.userprojects {
* started: true
* }
* started: true
* }
* user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that.
* ```
*
@@ -396,9 +396,9 @@ declare module "sequelize" {
* available as an object with the name of the through model.
* ```js
* user.getProjects().then(function (projects) {
* var p1 = projects[0]
* p1.userprojects.started // Is this project started yet?
* })
* var p1 = projects[0]
* p1.userprojects.started // Is this project started yet?
* })
* ```
*
* @param target The model that will be associated with hasOne relationship
@@ -421,8 +421,8 @@ declare module "sequelize" {
* the project has been started yet:
* ```js
* var UserProjects = sequelize.define('userprojects', {
* started: Sequelize.BOOLEAN
* })
* started: Sequelize.BOOLEAN
* })
* User.belongsToMany(Project, { through: UserProjects })
* Project.belongsToMany(User, { through: UserProjects })
* ```
@@ -436,8 +436,8 @@ declare module "sequelize" {
*
* ```js
* p1.userprojects {
* started: true
* }
* started: true
* }
* user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that.
* ```
*
@@ -445,9 +445,9 @@ declare module "sequelize" {
* available as an object with the name of the through model.
* ```js
* user.getProjects().then(function (projects) {
* var p1 = projects[0]
* p1.userprojects.started // Is this project started yet?
* })
* var p1 = projects[0]
* p1.userprojects.started // Is this project started yet?
* })
* ```
*
* @param target The model that will be associated with hasOne relationship
@@ -813,15 +813,15 @@ declare module "sequelize" {
*
* ```js
* sequelize.define('Model', {
* foreign_id: {
* type: Sequelize.INTEGER,
* references: {
* model: OtherModel,
* key: 'id',
* deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE
* }
* }
* });
* foreign_id: {
* type: Sequelize.INTEGER,
* references: {
* model: OtherModel,
* key: 'id',
* deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE
* }
* }
* });
* ```
*
* The constraints can be configured in a transaction like this. It will
@@ -1074,16 +1074,16 @@ declare module "sequelize" {
* ```js
* // Method 1
* sequelize.define(name, { attributes }, {
* hooks: {
* beforeBulkCreate: function () {
* // can be a single function
* },
* beforeValidate: [
* function () {},
* function() {} // Or an array of several
* ]
* }
* })
* hooks: {
* beforeBulkCreate: function () {
* // can be a single function
* },
* beforeValidate: [
* function () {},
* function() {} // Or an array of several
* ]
* }
* })
*
* // Method 2
* Model.hook('afterDestroy', function () {})
@@ -1563,7 +1563,7 @@ declare module "sequelize" {
* @param options.plain If set to true, included instances will be returned as plain objects
*/
get( key : string, options? : { plain? : boolean, clone? : boolean } ) : any;
get( options? : { plain? : boolean, clone? : boolean } ) : Object;
get( options? : { plain? : boolean, clone? : boolean } ) : TAttributes;
/**
* Set is used to update values on the instance (the sequelize representation of the instance that is,
@@ -1716,7 +1716,7 @@ declare module "sequelize" {
* Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all
* values gotten from the DB, and apply all custom getters.
*/
toJSON() : Object;
toJSON() : TAttributes;
}
@@ -2439,32 +2439,32 @@ declare module "sequelize" {
* Apply a scope created in `define` to the model. First let's look at how to create scopes:
* ```js
* var Model = sequelize.define('model', attributes, {
* defaultScope: {
* where: {
* username: 'dan'
* },
* limit: 12
* },
* scopes: {
* isALie: {
* where: {
* stuff: 'cake'
* }
* },
* complexFunction: function(email, accessLevel) {
* return {
* where: {
* email: {
* $like: email
* },
* accesss_level {
* $gte: accessLevel
* }
* }
* }
* }
* }
* })
* defaultScope: {
* where: {
* username: 'dan'
* },
* limit: 12
* },
* scopes: {
* isALie: {
* where: {
* stuff: 'cake'
* }
* },
* complexFunction: function(email, accessLevel) {
* return {
* where: {
* email: {
* $like: email
* },
* accesss_level {
* $gte: accessLevel
* }
* }
* }
* }
* }
* })
* ```
* Now, since you defined a default scope, every time you do Model.find, the default scope is appended to
* your query. Here's a couple of examples:
@@ -2490,11 +2490,11 @@ declare module "sequelize" {
* __Simple search using AND and =__
* ```js
* Model.findAll({
* where: {
* attr1: 42,
* attr2: 'cake'
* }
* })
* where: {
* attr1: 42,
* attr2: 'cake'
* }
* })
* ```
* ```sql
* WHERE attr1 = 42 AND attr2 = 'cake'
@@ -2504,21 +2504,21 @@ declare module "sequelize" {
* ```js
*
* Model.findAll({
* where: {
* attr1: {
* gt: 50
* },
* attr2: {
* lte: 45
* },
* attr3: {
* in: [1,2,3]
* },
* attr4: {
* ne: 5
* }
* }
* })
* where: {
* attr1: {
* gt: 50
* },
* attr2: {
* lte: 45
* },
* attr3: {
* in: [1,2,3]
* },
* attr4: {
* ne: 5
* }
* }
* })
* ```
* ```sql
* WHERE attr1 > 50 AND attr2 <= 45 AND attr3 IN (1,2,3) AND attr4 != 5
@@ -2529,14 +2529,14 @@ declare module "sequelize" {
* __Queries using OR__
* ```js
* Model.findAll({
* where: Sequelize.and(
* { name: 'a project' },
* Sequelize.or(
* { id: [1,2,3] },
* { id: { gt: 10 } }
* )
* )
* })
* where: Sequelize.and(
* { name: 'a project' },
* Sequelize.or(
* { id: [1,2,3] },
* { id: { gt: 10 } }
* )
* )
* })
* ```
* ```sql
* WHERE name = 'a project' AND (id` IN (1,2,3) OR id > 10)
@@ -2587,12 +2587,12 @@ declare module "sequelize" {
*
* ```js
* Model.findAndCountAll({
* where: ...,
* limit: 12,
* offset: 12
* }).then(function (result) {
* ...
* })
* where: ...,
* limit: 12,
* offset: 12
* }).then(function (result) {
* ...
* })
* ```
* In the above example, `result.rows` will contain rows 13 through 24, while `result.count` will return
* the
@@ -2605,11 +2605,11 @@ declare module "sequelize" {
* Suppose you want to find all users who have a profile attached:
* ```js
* User.findAndCountAll({
* include: [
* { model: Profile, required: true}
* ],
* limit 3
* });
* include: [
* { model: Profile, required: true}
* ],
* limit 3
* });
* ```
* Because the include for `Profile` has `required` set it will result in an inner join, and only the users
* who have a profile will be counted. If we remove `required` from the include, both users with and
@@ -3123,7 +3123,7 @@ declare module "sequelize" {
/**
* If this column references another table, provide it here as a Model, or a string
*/
model?: Model<any, any>;
model?: string | Model<any, any>;
/**
* The column of the foreign table that this column references
@@ -3149,7 +3149,7 @@ declare module "sequelize" {
/**
* A string or a data type
*/
type: string | DataTypeAbstract;
type: string | DataTypeAbstract;
/**
* If true, the column will get a unique constraint. If a string is provided, the column will be part of a
@@ -3218,11 +3218,11 @@ declare module "sequelize" {
*
* ```js
* sequelize.define('model', {
* states: {
* type: Sequelize.ENUM,
* values: ['active', 'pending', 'deleted']
* }
* })
* states: {
* type: Sequelize.ENUM,
* values: ['active', 'pending', 'deleted']
* }
* })
* ```
*/
values? : Array<string>;
@@ -3265,7 +3265,7 @@ declare module "sequelize" {
* The type of query you are executing. The query type affects how results are formatted before they are
* passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts.
*/
type?: string;
type?: string;
/**
* If true, transforms objects with `.` separated property names into nested objects using
@@ -4042,8 +4042,8 @@ declare module "sequelize" {
* Convert a user's username to upper case
* ```js
* instance.updateAttributes({
* username: self.sequelize.fn('upper', self.sequelize.col('username'))
* })
* username: self.sequelize.fn('upper', self.sequelize.col('username'))
* })
* ```
* @param fn The function you want to call
* @param args All further arguments will be passed as arguments to the function
@@ -4211,22 +4211,22 @@ declare module "sequelize" {
*
* ```js
* sequelize.define('modelName', {
* columnA: {
* type: Sequelize.BOOLEAN,
* validate: {
* is: ["[a-z]",'i'], // will only allow letters
* max: 23, // only allow values <= 23
* isIn: {
* args: [['en', 'zh']],
* msg: "Must be English or Chinese"
* }
* },
* field: 'column_a'
* // Other attributes here
* },
* columnB: Sequelize.STRING,
* columnC: 'MY VERY OWN COLUMN TYPE'
* })
* columnA: {
* type: Sequelize.BOOLEAN,
* validate: {
* is: ["[a-z]",'i'], // will only allow letters
* max: 23, // only allow values <= 23
* isIn: {
* args: [['en', 'zh']],
* msg: "Must be English or Chinese"
* }
* },
* field: 'column_a'
* // Other attributes here
* },
* columnB: Sequelize.STRING,
* columnC: 'MY VERY OWN COLUMN TYPE'
* })
*
* sequelize.models.modelName // The model will now be available in models under the name given to define
* ```
@@ -4297,12 +4297,12 @@ declare module "sequelize" {
*
* ```js
* sequelize.query('SELECT...').spread(function (results, metadata) {
* // Raw query - use spread
* });
* // Raw query - use spread
* });
*
* sequelize.query('SELECT...', { type: sequelize.QueryTypes.SELECT }).then(function (results) {
* // SELECT query - use then
* })
* // SELECT query - use then
* })
* ```
*
* @param sql
@@ -4417,12 +4417,12 @@ declare module "sequelize" {
*
* ```js
* sequelize.transaction().then(function (t) {
* return User.find(..., { transaction: t}).then(function (user) {
* return user.updateAttributes(..., { transaction: t});
* })
* .then(t.commit.bind(t))
* .catch(t.rollback.bind(t));
* })
* return User.find(..., { transaction: t}).then(function (user) {
* return user.updateAttributes(..., { transaction: t});
* })
* .then(t.commit.bind(t))
* .catch(t.rollback.bind(t));
* })
* ```
*
* A syntax for automatically committing or rolling back based on the promise chain resolution is also
@@ -4430,15 +4430,15 @@ declare module "sequelize" {
*
* ```js
* sequelize.transaction(function (t) { // Note that we use a callback rather than a promise.then()
* return User.find(..., { transaction: t}).then(function (user) {
* return user.updateAttributes(..., { transaction: t});
* });
* }).then(function () {
* // Commited
* }).catch(function (err) {
* // Rolled back
* console.error(err);
* });
* return User.find(..., { transaction: t}).then(function (user) {
* return user.updateAttributes(..., { transaction: t});
* });
* }).then(function () {
* // Commited
* }).catch(function (err) {
* // Rolled back
* console.error(err);
* });
* ```
*
* If you have [CLS](https://github.com/othiym23/node-continuation-local-storage) enabled, the transaction
@@ -4555,27 +4555,27 @@ declare module "sequelize" {
*
* ```js
* {
* READ_UNCOMMITTED: "READ UNCOMMITTED",
* READ_COMMITTED: "READ COMMITTED",
* REPEATABLE_READ: "REPEATABLE READ",
* SERIALIZABLE: "SERIALIZABLE"
* }
* READ_UNCOMMITTED: "READ UNCOMMITTED",
* READ_COMMITTED: "READ COMMITTED",
* REPEATABLE_READ: "REPEATABLE READ",
* SERIALIZABLE: "SERIALIZABLE"
* }
* ```
*
* Pass in the desired level as the first argument:
*
* ```js
* return sequelize.transaction({
* isolationLevel: Sequelize.Transaction.SERIALIZABLE
* }, function (t) {
*
* // your transactions
*
* }).then(function(result) {
* // transaction has been committed. Do something after the commit if required.
* }).catch(function(err) {
* // do something with the err.
* });
* isolationLevel: Sequelize.Transaction.SERIALIZABLE
* }, function (t) {
*
* // your transactions
*
* }).then(function(result) {
* // transaction has been committed. Do something after the commit if required.
* }).catch(function(err) {
* // do something with the err.
* });
* ```
*
* @see ISOLATION_LEVELS
@@ -4597,23 +4597,23 @@ declare module "sequelize" {
* ```js
* t1 // is a transaction
* Model.findAll({
* where: ...,
* transaction: t1,
* lock: t1.LOCK...
* });
* where: ...,
* transaction: t1,
* lock: t1.LOCK...
* });
* ```
*
* Postgres also supports specific locks while eager loading by using OF:
* ```js
* UserModel.findAll({
* where: ...,
* include: [TaskModel, ...],
* transaction: t1,
* lock: {
* level: t1.LOCK...,
* of: UserModel
* }
* });
* where: ...,
* include: [TaskModel, ...],
* transaction: t1,
* lock: {
* level: t1.LOCK...,
* of: UserModel
* }
* });
* ```
* UserModel will be locked but TaskModel won't!
*/
+5 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for stripe
// Project: https://stripe.com/
// Definitions by: Eric J. Smith <https://github.com/ejsmith/>
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface StripeStatic {
@@ -11,6 +11,7 @@ interface StripeStatic {
cardType(cardNumber: string): string;
getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
card: StripeCardData;
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
}
interface StripeTokenData {
@@ -57,8 +58,9 @@ interface StripeCardData {
address_state?: string;
address_zip?: string;
address_country?: string;
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
}
declare var Stripe: StripeStatic;
declare module "Stripe" {
export = StripeStatic;
}
+2 -2
View File
@@ -7,7 +7,7 @@ var tqos = new dds.TopicQos();
var chatTopic = new dds.Topic(0, 'ChatMessage', tqos);
runtime.registerTopic(chatTopic);
var writerQos = new dds.DataWriterQos();
var writerQos = new dds.DataWriterQos(dds.Partition("chatroom"), dds.Reliability.Reliable, dds.Durability.Persistent);
var writer = new dds.DataWriter(runtime, chatTopic, writerQos);
writer.write({
@@ -15,7 +15,7 @@ writer.write({
msg : "Hello World!"
});
var readerQos = new dds.DataReaderQos();
var readerQos = new dds.DataReaderQos(dds.Partition("chatroom"), dds.Reliability.Reliable, dds.Durability.Persistent);
var reader = new dds.DataReader(runtime, chatTopic, readerQos);
reader.addListener(function(msg) {
+25 -39
View File
@@ -39,11 +39,11 @@ declare module DDS {
/**
* KeepAll - KEEP_ALL qos policy
*/
KeepAll:any;
static KeepAll:any;
/**
* KeepLast - KEEP_LAST qos policy
*/
KeepLast:any;
static KeepLast:any;
}
/**
@@ -62,51 +62,37 @@ declare module DDS {
/**
* Reliable - 'Reliable' reliability policy
*/
Reliable:any;
static Reliable:any;
/**
* BestEffort - 'BestEffort' reliability policy
*/
BestEffort:any;
static BestEffort:any;
}
/**
* Partition policy
* Create new partition policy
*
* @param policies - partition names
* @example var qos = Partition('p1', 'p2')
*/
export class Partition implements Policy {
/**
* Create new partition policy
*
* @param policies - partition names
* @example var qos = Partition('p1', 'p2')
*/
constructor(...policies:string[]);
}
export function Partition(...policies:string[]):Policy;
/**
* Content Filter policy
* Create new content filter policy
*
* @param expr - filter expression
* @example var filter = ContentFilter("x>10 AND y<50")
*/
export class ContentFilter implements Policy {
/**
* Create new content filter policy
*
* @param expr - filter expression
* @example var filter = ContentFilter("x>10 AND y<50")
*/
constructor(expr:string);
}
export function ContentFilter(expr:string):Policy;
/**
* Time Filter policy
* Create new time filter policy
*
* @param period - time duration (unit ?)
* @example var filter = TimeFilter(100)
*/
export class TimeFilter implements Policy {
/**
* Create new content filter policy
*
* @param period - time duration (unit ?)
* @example var filter = TimeFilter(100)
*/
constructor(period:number);
}
export function TimeFilter(period:number):Policy;
/**
* Durability Policy
@@ -125,19 +111,19 @@ declare module DDS {
/**
* Volatile - Volatile durability policy
*/
Volatile:any;
static Volatile:any;
/**
* TransientLocal - TransientLocal durability policy
*/
TransientLocal:any;
static TransientLocal:any;
/**
* Transient - Transient durability policy
*/
Transient:any;
static Transient:any;
/**
* Persistent - Persistent durability policy
*/
Persistent:any;
static Persistent:any;
}
@@ -473,7 +459,7 @@ declare module DDS {
export var runtime:{
Runtime : Runtime;
}
};
export var VERSION:string;
}