Merge remote-tracking branch 'remotes/parent/master'

This commit is contained in:
David Driscoll
2014-04-15 15:15:24 -04:00
121 changed files with 145758 additions and 470 deletions
+17 -1
View File
@@ -37,8 +37,10 @@ List of Definitions
* [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap) (by [Brian Surowiec](https://github.com/xt0rted))
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
* [asciify](https://github.com/olizilla/asciify) (by [Alan](http://alan.norbauer.com))
* [assert](https://github.com/Jxck/assert) (by [vvakame](https://github.com/vvakame))
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
* [Atom](https://atom.io/) (by [vvakame](https://github.com/vvakame))
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
* [Backbone Relational](http://backbonerelational.org/) (by [Eirik Hoem](https://github.com/eirikhm))
* [BigScreen](http://brad.is/coding/BigScreen/) (by [Douglas Eichelberger](https://github.com/dduugg))
@@ -53,18 +55,21 @@ List of Definitions
* [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber))
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber) and [otiai10](https://github.com/otiai10))
* [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay))
* [CKEditor](https://github.com/ckeditor/ckeditor-dev) (by [Ondrej Sevcik](https://github.com/ondrejsevcik))
* [Clone](https://github.com/pvorb/node-clone) (by [Kieran Simpson](https://github.com/kierans))
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem))
* [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds))
* [Cordova](http://cordova.apache.org) (by [Microsoft Open Technologies, Inc.](http://msopentech.com/))
* [Couchbase / Couchnode](https://github.com/couchbase/couchnode) (by [Basarat Ali Syed](https://github.com/basarat))
* [Crossfilter](https://github.com/square/crossfilter) (by [Schmulik Raskin](https://github.com/schmuli))
* [crypto-js](https://code.google.com/p/crypto-js/) (by [Gia Bảo @ Sân Đình](https://github.com/giabao)). @see [cryptojs.d.ts repo](https://github.com/giabao/cryptojs.d.ts)
* [d3.js](http://d3js.org/) (from TypeScript samples)
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [diff](https://github.com/kpdecker/jsdiff) (by [vvakame](http://github.com/vvakame))
* [Dock Spawn](http://dockspawn.com) (by [Drew Noakes](https://drewnoakes.com))
* [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton))
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
@@ -73,6 +78,7 @@ List of Definitions
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
* [EasyStar](http://easystarjs.com/) (by [Magnus Gustafsson](https://github.com/Borundin))
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [emissary](https://github.com/atom/emissary) (by [vvakame](https://github.com/vvakame))
* [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [ES6-Promises](https://github.com/jakearchibald/ES6-Promises) (by [François de Campredon](https://github.com/fdecampredon/))
* [expect.js](https://github.com/LearnBoost/expect.js) (by [Teppei Sato](https://github.com/teppeis))
@@ -110,6 +116,7 @@ List of Definitions
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [HashSet](http://www.timdown.co.uk/jshashtable/jshashset.html) (by [Sergey Gerasimov](https://github.com/gerich-home))
* [Hashtable](http://www.timdown.co.uk/jshashtable/) (by [Sergey Gerasimov](https://github.com/gerich-home))
* [HelloJS](http://adodson.com/hello.js) (by [Pavel Zika](https://github.com/PavelPZ))
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
* [Highland](http://highlandjs.org/) (by [Bart van der Schoor](https://github.com/Bartvds/))
* [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee))
@@ -153,6 +160,7 @@ List of Definitions
* [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/))
* [jQuery.pickadate](https://github.com/amsul/pickadate.js) (by [Theodore Brown](https://github.com/theodorejb))
* [jQuery.payment](http://needim.github.io/noty/) (by [Eric J. Smith](https://github.com/ejsmith/))
* [jQuery.pnotify](http://sciactive.github.io/pnotify/ (by [David Sichau](https://github.com/DavidSichau/))
* [jQuery.scrollTo](https://github.com/flesler/jquery.scrollTo) (by [Neil Stalker](https://github.com/nestalk/))
* [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/))
* [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski))
@@ -172,6 +180,7 @@ List of Definitions
* [JSDeferred](http://cho45.stfuawsc.com/jsdeferred/) (by [Daisuke Mino](https://github.com/minodisk))
* [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) (by [Vincent Bortone](https://github.com/vbortone/))
* [JSON-Pointer](https://www.npmjs.org/package/json-pointer) (by [Bart van der Schoor](https://github.com/Bartvds))
* [JsRender](http://www.jsviews.com/#jsrender) (by [Kensuke MATSUZAKI](https://github.com/zakki))
* [jStorage](http://www.jstorage.info/) (by [Danil Flores](https://github.com/dflor003/))
* [JWPlayer](http://developer.longtailvideo.com/trac/) (by [Martin Duparc](https://github.com/martinduparc/))
* [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) (by [Vincent Bortone](https://github.com/vbortone/))
@@ -203,6 +212,7 @@ List of Definitions
* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave))
* [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk))
* [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds))
* [mixto](https://github.com/atom/mixto) (by [vvakame](https://github.com/vvakame))
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/))
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
* [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee))
@@ -215,11 +225,16 @@ List of Definitions
* [node-git](https://github.com/christkv/node-git) (by [vvakame](https://github.com/vvakame))
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
* [notify.js](https://github.com/alexgibson/notify.js) (by [soundTricker](https://github.com/soundTricker))
* [NProgress](https://github.com/rstacruz/nprogress) (by [Judah Gabriel Himango](https://github.com/judahgabriel))
* [Numeral.js](https://github.com/adamwdraper/Numeral-js) (by [Vincent Bortone](https://github.com/vbortone/))
* [OpenLayers](https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/))
* [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
* [pathwatcher](http://atom.github.io/node-pathwatcher/) (by [vvakame](https://github.com/vvakame))
* [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin))
* [Parsimmon](https://github.com/jayferd/parsimmon) (by [Bart van der Schoor](https://github.com/Bartvds))
* [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin))
* [PEG.js](http://pegjs.majda.cz/) (by [vvakame](https://github.com/vvakame))
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))
* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
@@ -287,6 +302,7 @@ List of Definitions
* [WinJS](http://msdn.microsoft.com/en-us/library/windows/apps/br229773.aspx) (from TypeScript samples)
* [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples)
* [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd))
* [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds))
* [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/))
* [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy))
* [YouTube Data API](https://developers.google.com/youtube/v3/) (by [Frank M](https://github.com/sgtfrankieboy/))
+7 -4
View File
@@ -1290,13 +1290,19 @@ var DT;
if (argv.help) {
optimist.showHelp();
var pkg = require('../../package.json');
console.log('Scripts:');
console.log('');
Lazy(pkg.scripts).keys().each(function (key) {
console.log(' $ npm run ' + key);
});
process.exit(0);
}
var testFull = process.env['TRAVIS_BRANCH'] ? /\w\/full$/.test(process.env['TRAVIS_BRANCH']) : false;
new TestRunner(dtPath, {
concurrent: argv['single-thread'] ? 1 : Math.max(cpuCores, 2),
concurrent: argv['single-thread'] ? 1 : Math.max(Math.min(24, cpuCores), 2),
tscVersion: argv['tsc-version'],
testChanges: testFull ? false : argv['test-changes'],
skipTests: argv['skip-tests'],
@@ -1312,7 +1318,4 @@ var DT;
process.exit(2);
});
})(DT || (DT = {}));
//grunt-start
/// <reference path="../runner.ts" />
//grunt-end
//# sourceMappingURL=runner.js.map
+11 -1
View File
@@ -34,6 +34,10 @@ module DT {
export var DEFAULT_TSC_VERSION = '0.9.7';
interface PackageJSON {
scripts: {[key:string]: string};
}
/////////////////////////////////
// Single test
/////////////////////////////////
@@ -333,13 +337,19 @@ module DT {
if (argv.help) {
optimist.showHelp();
var pkg: PackageJSON = require('../../package.json');
console.log('Scripts:');
console.log('');
Lazy(pkg.scripts).keys().each((key) => {
console.log(' $ npm run ' + key);
});
process.exit(0);
}
var testFull = process.env['TRAVIS_BRANCH'] ? /\w\/full$/.test(process.env['TRAVIS_BRANCH']) : false;
new TestRunner(dtPath, {
concurrent: argv['single-thread'] ? 1 : Math.max(cpuCores, 2),
concurrent: argv['single-thread'] ? 1 : Math.max(Math.min(24, cpuCores), 2),
tscVersion: argv['tsc-version'],
testChanges: testFull ? false : argv['test-changes'], // allow magic branch
skipTests: argv['skip-tests'],
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./tsc.js')
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -26,6 +26,7 @@ declare module ng.ui {
interface IStateProvider extends IServiceProvider {
state(name:string, config:IState): IStateProvider;
state(config:IState): IStateProvider;
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
}
@@ -73,7 +74,7 @@ declare module ng.ui {
}
interface IStateService {
go(to: string, params?: {}, options?: IStateOptions): void;
go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
includes(state: string, params?: {}): boolean;
+2 -2
View File
@@ -10,7 +10,7 @@ declare var angular: ng.IAngularStatic;
// Support for painless dependency injection
interface Function {
$inject:string[];
$inject?: string[];
}
///////////////////////////////////////////////////////////////////////////////
@@ -238,7 +238,7 @@ declare module ng {
$parent: IScope;
$id: number;
$id: string;
// Hidden members
$$isolateBindings: any;
+9
View File
@@ -0,0 +1,9 @@
/// <reference path="./asciify.d.ts" />
import asciify = require('asciify');
asciify('Whoa', function(err, result){console.log(result)});
asciify('Whoa', '3-d', function(err, result){console.log(result)});
asciify('Whoa', {font:'3-d'}, function(err, result){console.log(result)});
asciify.getFonts(function(err, fonts) { fonts.slice(0); });
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for asciify 1.3.5
// Project: https://www.npmjs.org/package/asciify
// Definitions by: Alan Norbauer http://alan.norbauer.com
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
interface AsciifyOptions {
font?: string;
maxWidth?: number;
color?: string;
}
interface AsciifyCallback {
// err is sometimes a string and sometimes an Error
(err: any, asciifiedText: string): void
}
declare module "asciify" {
function asciify(text: string, callback: AsciifyCallback): void;
function asciify(text: string, options: string, callback: AsciifyCallback): void;
function asciify(text: string, options: AsciifyOptions, callback: AsciifyCallback): void;
module asciify {
function getFonts(callback: (err: Error, fonts: string[]) => void): void;
}
export = asciify
}
+1
View File
@@ -0,0 +1 @@
"--noImplicitAny --module commonjs"
+77
View File
@@ -0,0 +1,77 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="./atom.d.ts" />
/// <reference path="../pathwatcher/pathwatcher.d.ts" />
import path = require("path");
import _atom = require("atom");
import pathwatcher = require("pathwatcher");
var File = pathwatcher.File;
class SampleView extends _atom.ScrollView {
editorId:string;
file:pathwatcher.IFile;
editor:AtomCore.IEditor;
static deserialize(state:any):SampleView {
return new SampleView(state);
}
static content():any {
return this.div({class: 'sample native-key-bindings', tabindex: -1});
}
constructor(params:{editorId?:string; filePath?:string;} = {}) {
super();
this.editorId = params.editorId;
if (this.editorId) {
this.resolveEditor(this.editorId);
} else {
this.file = new File(params.filePath);
}
}
get jq():JQuery {
// dirty hack
return <any>this;
}
serialize() {
return {
deserializer: 'SampleView',
editorId: this.editorId
};
}
destroy() {
this.unsubscribe();
}
resolveEditor(editorId:string) {
var resolve = ()=> {
if (this.editor) {
this.jq.trigger("title-changed");
} else {
var view = this.jq.parents('.pane').view();
if (view) {
view.destroyItem(this);
}
}
};
if (atom.workspace) {
resolve();
} else {
atom.packages.once("activated", ()=> {
resolve();
});
}
}
}
atom.deserializers.add(SampleView);
export = SampleView;
+1
View File
@@ -0,0 +1 @@
--noImplicitAny --module commonjs --target es5
+736
View File
@@ -0,0 +1,736 @@
// Type definitions for Atom
// Project: https://atom.io/
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../q/Q.d.ts" />
/// <reference path="../space-pen/space-pen.d.ts" />
/// <reference path="../emissary/emissary.d.ts" />
// Policy: this definition file only declare element related to `atom`.
// if js file include to another npm package (e.g. "space-pen", "mixto" and "emissary").
// you should create a separate file.
// NOTE Document? You should use DevTools hehe...
interface Window {
atom: AtomCore.IAtom;
measure(description:string, fn:Function):any; // return fn result
profile(description:string, fn:Function):any; // return fn result
}
declare module AtomCore {
// https://atom.io/docs/v0.84.0/advanced/view-system
interface IWorkspaceView {
prependToBottom:any;
prependToTop:any;
prependToLeft:any;
prependToRight:any;
appendToBottom:any;
appendToTop:any;
appendToLeft:any;
appendToRight:any;
command: Function;
}
interface IPanes {
// TBD
}
interface TreeView {
// TBD
}
interface ICommandPanel {
// TBD
}
interface ITextBuffer {
// TBD
}
interface IDisplayBuffer {
buffer: ITextBuffer;
// TBD
}
interface ICursor {
// TBD
}
interface ILanguageMode {
// TBD
}
interface ISelection {
// TBD
}
interface ISubscription {
// TBD
}
interface IEditor {
// Serializable.includeInto(Editor);
// Delegator.includeInto(Editor);
deserializing:boolean;
callDisplayBufferCreatedHook:boolean;
registerEditor:boolean;
buffer:ITextBuffer;
languageMode: ILanguageMode;
cursors:ICursor[];
selections: ISelection[];
suppressSelectionMerging:boolean;
softTabs: boolean;
displayBuffer: IDisplayBuffer;
id:number;
behaviors:any;
declaredPropertyValues: any;
eventHandlersByEventName: any;
eventHandlersByNamespace: any;
lastOpened: number;
subscriptionCounts: any;
subscriptionsByObject: any; /* WeakMap */
subscriptions: ISubscription[];
serializeParams():{id:number; softTabs:boolean; scrollTop:number; scrollLeft:number; displayBuffer:any;};
deserializeParams(params:any):any;
subscribeToBuffer():void;
subscribeToDisplayBuffer():void;
getViewClass():any; // return type are EditorView
destroyed():void;
copy():IEditor;
getTitle():string;
getLongTitle():string;
setVisible(visible:boolean):void;
setScrollTop(scrollTop:any):void;
getScrollTop():any;
setScrollLeft(scrollLeft:any):void;
getScrollLeft():any;
setEditorWidthInChars(editorWidthInChars:any):void;
getSoftWrapColumn():any;
getSoftTabs():boolean;
setSoftTabs(softTabs:boolean):void;
getSoftWrap():any;
setSoftWrap(softWrap:any):void;
getTabText():any;
getTabLength():any;
setTabLength(tabLength:any):void;
clipBufferPosition(bufferPosition:any):void;
clipBufferRange(range:any):void;
indentationForBufferRow(bufferRow:any):void;
setIndentationForBufferRow(bufferRow:any, newLevel:any, _arg:any):void;
indentLevelForLine(line:any):number;
buildIndentString(number:any):any;
save():void;
saveAs(filePath:any):void;
getPath():any;
getText():any;
setText(text:any):void;
getTextInRange(range:any):any;
getLineCount():any;
getBuffer():any;
getUri():any;
isBufferRowBlank(bufferRow:any):void;
isBufferRowCommented(bufferRow:any):void;
nextNonBlankBufferRow(bufferRow:any):void;
getEofBufferPosition():any;
getLastBufferRow():any;
bufferRangeForBufferRow(row:any, options:any):any;
lineForBufferRow(row:any):any;
lineLengthForBufferRow(row:any):any;
scan():any;
scanInBufferRange():any;
backwardsScanInBufferRange():any;
isModified():any;
shouldPromptToSave():any;
screenPositionForBufferPosition(bufferPosition:any, options:any):any;
bufferPositionForScreenPosition(screenPosition:any, options:any):any;
screenRangeForBufferRange(bufferRange:any):any;
bufferRangeForScreenRange(screenRange:any):any;
clipScreenPosition(screenPosition:any, options:any):any;
lineForScreenRow(row:any):any;
linesForScreenRows(start:any, end:any):any;
getScreenLineCount():any;
getMaxScreenLineLength():any;
getLastScreenRow():any;
bufferRowsForScreenRows(startRow:any, endRow:any):any;
bufferRowForScreenRow(row:any):any;
scopesForBufferPosition(bufferPosition:any):any;
bufferRangeForScopeAtCursor(selector:any):any;
tokenForBufferPosition(bufferPosition:any):any;
getCursorScopes():any;
insertText(text:any, options:any):any;
insertNewline():any;
insertNewlineBelow():any;
insertNewlineAbove():any;
indent(options?:any):any;
backspace():any;
backspaceToBeginningOfWord():any;
backspaceToBeginningOfLine():any;
delete():any;
deleteToEndOfWord():any;
deleteLine():any;
indentSelectedRows():any;
outdentSelectedRows():any;
toggleLineCommentsInSelection():any;
autoIndentSelectedRows():any;
normalizeTabsInBufferRange(bufferRange:any):any;
cutToEndOfLine():any;
cutSelectedText():any;
copySelectedText():any;
pasteText(options?:any):any;
undo():any;
redo():any;
foldCurrentRow():any;
unfoldCurrentRow():any;
foldSelectedLines():any;
foldAll():any;
unfoldAll():any;
foldAllAtIndentLevel(level:any):any;
foldBufferRow(bufferRow:any):any;
unfoldBufferRow(bufferRow:any):any;
isFoldableAtBufferRow(bufferRow:any):any;
createFold(startRow:any, endRow:any):any;
destroyFoldWithId(id:any):any;
destroyFoldsIntersectingBufferRange(bufferRange:any):any;
toggleFoldAtBufferRow(bufferRow:any):any;
isFoldedAtCursorRow():any;
isFoldedAtBufferRow(bufferRow:any):any;
isFoldedAtScreenRow(screenRow:any):any;
largestFoldContainingBufferRow(bufferRow:any):any;
largestFoldStartingAtScreenRow(screenRow:any):any;
outermostFoldsInBufferRowRange(startRow:any, endRow:any):any;
moveLineUp():any;
moveLineDown():any;
duplicateLines():any;
duplicateLine():any;
mutateSelectedText(fn:Function):any;
replaceSelectedText(options:any, fn:Function):any;
getMarker(id:any):any;
getMarkers():any;
findMarkers(properties:any):any;
markScreenRange():any;
markBufferRange():any;
markScreenPosition():any;
markBufferPosition():any;
destroyMarker():any;
getMarkerCount():any;
hasMultipleCursors():any;
getCursors():any;
getCursor():any;
addCursorAtScreenPosition(screenPosition:any):any;
addCursorAtBufferPosition(bufferPosition:any):any;
addCursor(marker:any):any;
removeCursor(cursor:any):any;
addSelection(marker:any, options:any):any;
addSelectionForBufferRange(bufferRange:any, options:any):any;
setSelectedBufferRange(bufferRange:any, options:any):any;
setSelectedBufferRanges(bufferRanges:any, options:any):any;
removeSelection(selection:any):any;
clearSelections():any;
consolidateSelections():any;
getSelections():any;
getSelection(index:any):any;
getLastSelection():any;
getSelectionsOrderedByBufferPosition():any;
getLastSelectionInBuffer():any;
selectionIntersectsBufferRange(bufferRange:any):any;
setCursorScreenPosition(position:any, options:any):any;
getCursorScreenPosition():any;
getCursorScreenRow():any;
setCursorBufferPosition(position:any, options:any):any;
getCursorBufferPosition():any;
getSelectedScreenRange():any;
getSelectedBufferRange():any;
getSelectedBufferRanges():any;
getSelectedText():any;
getTextInBufferRange(range:any):any;
setTextInBufferRange(range:any, text:any):any;
getCurrentParagraphBufferRange():any;
getWordUnderCursor(options:any):any;
moveCursorUp(lineCount:any):any;
moveCursorDown(lineCount:any):any;
moveCursorLeft():any;
moveCursorRight():any;
moveCursorToTop():any;
moveCursorToBottom():any;
moveCursorToBeginningOfScreenLine():any;
moveCursorToBeginningOfLine():any;
moveCursorToFirstCharacterOfLine():any;
moveCursorToEndOfScreenLine():any;
moveCursorToEndOfLine():any;
moveCursorToBeginningOfWord():any;
moveCursorToEndOfWord():any;
moveCursorToBeginningOfNextWord():any;
moveCursorToPreviousWordBoundary():any;
moveCursorToNextWordBoundary():any;
moveCursors(fn:Function):any;
selectToScreenPosition(position:any):any;
selectRight():any;
selectLeft():any;
selectUp(rowCount:any):any;
selectDown(rowCount:any):any;
selectToTop():any;
selectAll():any;
selectToBottom():any;
selectToBeginningOfLine():any;
selectToFirstCharacterOfLine():any;
selectToEndOfLine():any;
selectToPreviousWordBoundary():any;
selectToNextWordBoundary():any;
selectLine():any;
addSelectionBelow():any;
addSelectionAbove():any;
splitSelectionsIntoLines():any;
transpose():any;
upperCase():any;
lowerCase():any;
joinLines():any;
selectToBeginningOfWord():any;
selectToEndOfWord():any;
selectToBeginningOfNextWord():any;
selectWord():any;
selectMarker(marker:any):any;
mergeCursors():any;
expandSelectionsForward():any;
expandSelectionsBackward(fn:Function):any;
finalizeSelections():any;
mergeIntersectingSelections():any;
preserveCursorPositionOnBufferReload():any;
getGrammar(): IGrammar;
setGrammar(grammer:IGrammar):void;
reloadGrammar():any;
shouldAutoIndent():any;
transact(fn:Function):any;
beginTransaction():any;
commitTransaction():any;
abortTransaction():any;
inspect():any;
logScreenLines(start:any, end:any):any;
handleGrammarChange():any;
handleMarkerCreated(marker:any):any;
getSelectionMarkerAttributes():any;
joinLine():any;
}
interface IGrammar {
scopeName: string;
// TBD
}
interface IPane /* extends Theorist.Model */ {
items:any[];
activeItem:any;
serializeParams():any;
deserializeParams(params:any):any;
getViewClass():any; // return type are PaneView
isActive():boolean;
focus():void;
blur():void;
activate():void;
getPanes():IPane[];
getItems():any[];
getActiveItem():any;
getActiveEditor():any;
itemAtIndex(index:number):any;
activateNextItem():any;
activatePreviousItem():any;
getActiveItemIndex():number;
activateItemAtIndex(index:number):any;
activateItem(item:any):any;
addItem(item:any, index:number):any;
addItems(items:any[], index:number):any[];
removeItem(item:any, destroying:any):void;
moveItem(item:any, newIndex:number):void;
moveItemToPane(item:any, pane:IPane, index:number):void;
destroyActiveItem():boolean; // always return false
destroyItem(item:any):boolean;
destroyItems():any[];
destroyInactiveItems():any[];
destroy():void;
destroyed():any[];
promptToSaveItem(item:any):boolean;
saveActiveItem():void;
saveActiveItemAs():void;
saveItem(item:any, nextAction:Function):void;
saveItemAs(item:any, nextAction:Function):void;
saveItems():any[];
itemForUri(uri:any):any;
activateItemForUri(uri:any):any;
copyActiveItem():void;
splitLeft(params:any):IPane;
splitRight(params:any):IPane;
splitUp(params:any):IPane;
splitDown(params:any):IPane;
split(orientation:string, side:string, params:any):IPane;
findLeftmostSibling():IPane;
findOrCreateRightmostSibling():IPane;
}
// https://atom.io/docs/v0.84.0/advanced/serialization
interface ISerializationStatic<T> {
deserialize(data:ISerializationInfo):T;
new (data:T): ISerialization;
}
interface ISerialization {
serialize():ISerializationInfo;
}
interface ISerializationInfo {
deserializer: string;
}
interface IBrowserWindow {
getPosition():number[];
getSize():number[];
}
interface IAtomWindowDimentions {
x:number;
y:number;
width:number;
height:number;
}
interface IProject {
// TBD
}
interface IWorkspaceStatic {
new():IWorkspace;
}
interface IWorkspace {
deserializeParams(params:any):any;
serializeParams():{paneContainer:any;fullScreen:boolean;};
eachEditor(callback:Function):void;
getEditors():IEditor[];
open(uri:string, options:any):Q.Promise<View>;
openLicense():void;
openSync(uri:string, options:any):any;
openUriInPane(uri:string, pane:any, options:any):Q.Promise<View>;
reopenItemSync():any;
registerOpener(opener:(urlToOpen:string)=>any):void;
unregisterOpener(opener:Function):void;
getOpeners():any;
getActivePane(): IPane;
getPanes():any;
saveAll():void;
activateNextPane():any;
activatePreviousPane():any;
paneForUri: (uri:string) => IPane;
saveActivePaneItem():any;
saveActivePaneItemAs():any;
destroyActivePaneItem():any;
destroyActivePane():any;
getActiveEditor():IEditor;
increaseFontSize():void;
decreaseFontSize():void;
resetFontSize():void;
itemOpened(item:any):void;
onPaneItemDestroyed(item:any):void;
destroyed():void;
}
interface IAtomSettings {
appVersion: string;
bootstrapScript: string;
devMode: boolean;
initialPath: string;
pathToOpen: string;
resourcePath: string;
shellLoadTime: number;
windowState:string;
}
interface IAtomState {
mode:string;
packageStates:any;
project:any;
syntax:any;
version:number;
windowDimensions:any;
workspace:any;
}
interface IDeserializerManager {
deserializers:Function;
add:Function;
remove:Function;
deserialize:Function;
get:Function;
}
interface IConfig {
get(keyPath:string):any;
// TBD
}
interface IKeymapManager {
defaultTarget:HTMLElement;
// TBD
}
interface IPackageManager extends Emissary.IEmitter {
packageDirPaths:string[];
loadedPackages:any;
activePackages:any;
packageStates:any;
packageActivators:any[];
getApmPath():string;
getPackageDirPaths():string;
getPackageState(name:string):any;
setPackageState(name:string, state:any):void;
enablePackage(name:string):any;
disablePackage(name:string):any;
activate():void;
registerPackageActivator(activator:any, types:any):void;
activatePackages(packages:any):void;
activatePackage(name:string):void;
deactivatePackages():void;
deactivatePackage(name:string):void;
getActivePackages():any;
getActivePackage(name:string):any;
isPackageActive(name:string):boolean;
unobserveDisabledPackages():void;
observeDisabledPackages():void;
loadPackages():void;
loadPackage(nameOrPath:string):void;
unloadPackages():void;
unloadPackage(name:string):void;
getLoadedPackage(name:string):any;
isPackageLoaded(name:string):boolean;
getLoadedPackages():any;
getLoadedPackagesForTypes(types:any):any[];
resolvePackagePath(name:string):string;
isPackageDisabled(name:string):boolean;
hasAtomEngine(packagePath:string):boolean;
isBundledPackage(name:string):boolean;
getPackageDependencies():any;
getAvailablePackagePaths():any[];
getAvailablePackageNames():any[];
getAvailablePackageMetadata():any[];
}
interface IThemeManager {
// TBD
}
interface IContextMenuManager {
// TBD
}
interface IMenuManager {
// TBD
}
interface IClipboard {
// TBD
}
interface ISyntax {
// TBD
}
interface IWindowEventHandler {
// TBD
}
interface IAtomStatic extends ISerializationStatic<IAtom> {
version: number;
loadSettings: IAtomSettings;
loadOrCreate(mode:string):IAtom;
loadState(mode:any):void;
getStatePath(mode:any):string;
getConfigDirPath():string;
getStorageDirPath():string;
getLoadSettings():IAtomSettings;
getCurrentWindow():IBrowserWindow;
getVersion():string;
isReleasedVersion():boolean;
new(state:IAtomState):IAtom;
}
interface IAtom {
constructor:IAtomStatic;
state:IAtomState;
mode:string;
deserializers:IDeserializerManager;
config: IConfig;
keymaps: IKeymapManager;
keymap: IKeymapManager;
packages: IPackageManager;
themes: IThemeManager;
contextManu: IContextMenuManager;
menu: IMenuManager;
clipboard:IClipboard;
syntax:ISyntax;
windowEventHandler: IWindowEventHandler;
// really exists? start
subscribe:Function;
unsubscribe:Function;
loadTime:number;
workspaceViewParentSelector:string;
project: IProject;
workspaceView: IWorkspaceView;
workspace: IWorkspace;
// really exists? end
initialize:Function;
// registerRepresentationClass:Function;
// registerRepresentationClasses:Function;
setBodyPlatformClass:Function;
getCurrentWindow():IBrowserWindow;
getWindowDimensions:Function;
setWindowDimensions:Function;
restoreWindowDimensions:Function;
storeWindowDimensions:Function;
getLoadSettings:Function;
deserializeProject: Function;
deserializeWorkspaceView:Function;
deserializePackageStates:Function;
deserializeEditorWindow:Function;
startEditorWindow:Function;
unloadEditorWindow:Function;
loadThemes:Function;
watchThemes:Function;
open:Function;
confirm:Function;
showSaveDialog:Function;
showSaveDialogSync:Function;
openDevTools:Function;
toggleDevTools:Function;
executeJavaScriptInDevTools:Function;
reload:Function;
focus:Function;
show:Function;
hide:Function;
setSize:Function;
setPosition:Function;
center:Function;
displayWindow:Function;
close:Function;
exit:Function;
inDevMode:Function;
inSpecMode:Function;
toggleFullScreen:Function;
setFullScreen:Function;
isFullScreen:Function;
getVersion:Function;
isReleasedVersion:Function;
getGitHubAuthTokenName:Function;
setGitHubAuthToken:Function;
getGitHubAuthToken:Function;
getConfigDirPath:Function;
saveSync:Function;
getWindowLoadTime():number;
crashMainProcess:Function;
crashRenderProcess:Function;
beep:Function;
getUserInitScriptPath:Function;
requireUserInitScript:Function;
requireWithGlobals:Function;
}
interface IBufferedNodeProcessStatic {
new (arg:any):IBufferedNodeProcess;
}
interface IBufferedNodeProcess extends IBufferedProcess {
}
interface IBufferedProcessStatic {
new (arg:any):IBufferedProcess;
}
interface IBufferedProcess {
process:Function;
killed:boolean;
bufferStream:Function;
kill:Function;
}
interface IGitStatic {
new(path:any, options:any):IGit;
}
interface IGit {
}
interface IPointStatic {
new(row:any, column:any):IPoint;
}
interface IPoint {
// TBD
}
interface IRangeStatic {
new(pointA:IPoint, pointB:IPoint):IRange;
}
interface IRange {
// TBD
}
interface ITaskStatic {
new(taskPath:any):ITask;
}
interface ITask {
// TBD
}
}
declare var atom:AtomCore.IAtom;
declare module "atom" {
import spacePen = require("space-pen");
var $:typeof spacePen.$;
var $$$:typeof spacePen.$$$;
var BufferedNodeProcess:AtomCore.IBufferedNodeProcessStatic;
var BufferedProcess:AtomCore.IBufferedProcessStatic;
var EditorView:any;
var Git:AtomCore.IGitStatic;
var Point:AtomCore.IPointStatic;
var Range:AtomCore.IRangeStatic;
class View extends spacePen.View implements Emissary.ISubscriber {
// Subscriber.includeInto(spacePen.View);
// inherit from Subscriber
subscribeWith(eventEmitter:any, methodName:string, args:any):any;
addSubscription(subscription:any):any;
subscribe(eventEmitterOrSubscription:any, ...args:any[]):any;
subscribeToCommand(eventEmitter:any, ...args:any[]):any;
unsubscribe(object?:any):any;
}
class ScrollView extends View {
// TBD
}
var SelectListView:any;
var Task:AtomCore.ITaskStatic;
var Workspace:AtomCore.IWorkspaceStatic;
var WorkspaceView:any; // WorkspaceView extends View
}
+6 -3
View File
@@ -171,7 +171,8 @@ declare module Backbone {
remove(models: Model[], options?: Silenceable): Model[];
reset(models?: Model[], options?: Silenceable): Model[];
reset(models?: any[], options?: Silenceable): Model[];
shift(options?: Silenceable): Model;
set(models?: any[], options?: Silenceable): Model[];
shift(options?: Silenceable): Model;
sort(options?: Silenceable): Collection;
unshift(model: Model, options?: AddOptions): Model;
where(properies: any): Model[];
@@ -278,7 +279,8 @@ declare module Backbone {
loadUrl(fragmentOverride: string): boolean;
navigate(fragment: string, options?: any): boolean;
started: boolean;
options: any;
_updateHash(location: Location, fragment: string, replace: boolean): void;
}
@@ -330,7 +332,8 @@ declare module Backbone {
// SYNC
function sync(method: string, model: Model, options?: JQueryAjaxSettings): any;
var emulateHTTP: boolean;
function ajax(options?: JQueryAjaxSettings): JQueryXHR;
var emulateHTTP: boolean;
var emulateJSONBackbone: boolean;
// Utility
+1
View File
@@ -502,6 +502,7 @@ declare module breeze {
static fromEntityKey(entityKey: EntityKey): EntityQuery;
static fromEntityNavigation(entity: Entity, navigationProperty: NavigationProperty): EntityQuery;
inlineCount(enabled?: boolean): EntityQuery;
noTracking(enabled: boolean): EntityQuery;
orderBy(propertyPaths: string): EntityQuery;
orderBy(propertyPaths: string[]): EntityQuery;
orderByDesc(propertyPaths: string): EntityQuery;
+25
View File
@@ -20,12 +20,14 @@ interface Casper extends EventEmitter {
constructor (options: CasperOptions): Casper;
options: CasperOptions;
// Properties
__utils__: ClientUtils;
// Methods
back(): Casper;
base64encode(url: string, method?: string, data?: any): string;
bypass(nb: number): any;
click(selector: string): boolean;
clickLabel(label: string, tag?: string): boolean;
capture(targetFilePath: string, clipRect: ClipRect): Casper;
@@ -49,11 +51,15 @@ interface Casper extends EventEmitter {
forward(): Casper;
log(message: string, level?: string, space?: string): Casper;
fill(selector: string, values: any, submit?: boolean): void;
fillSelectors(selector: string, values: any, submit?: boolean): void;
fillXPath(selector: string, values: any, submit?: boolean): void;
getCurrentUrl(): string;
getElementAttribute(selector: string, attribute: string): string;
getElementsAttribute(selector: string, attribute: string): string;
getElementBounds(selector: string): ElementBounds;
getElementsBounds(selector: string): ElementBounds[];
getElementInfo(selector: string): ElementInfo;
getElementsInfo(selector: string): ElementInfo;
getFormValues(selector: string): any;
getGlobal(name: string): any;
getHTML(selector?: string, outer?: boolean): string;
@@ -66,24 +72,33 @@ interface Casper extends EventEmitter {
resourceExists(test: Function): boolean;
resourceExists(test: string): boolean;
run(onComplete: Function, time?: number): Casper;
scrollTo(x: number, y: number): Casper;
scrollToBottom(): Casper;
sendKeys(selector: string, keys: string, options?: any): Casper;
setHttpAuth(username: string, password: string): Casper;
start(url?: string, then?: (response: HttpResponse) => void): Casper;
status(asString: boolean): any;
then(fn: (self?: Casper) => void): Casper;
thenBypass(nb: number): Casper;
thenBypassIf(condition: any, nb: number): Casper;
thenBypassUnless(condition: any, nb: number): Casper;
thenClick(selector: string): Casper;
thenEvaluate(fn: () => any, ...args: any[]): Casper;
thenOpen(location: string, then?: (response: HttpResponse) => void): Casper;
thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper;
thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper;
toString(): string;
unwait(): Casper;
userAgent(agent: string): string;
viewport(width: number, height: number): Casper;
visible(selector: string): boolean;
wait(timeout: number, then?: Function): Casper;
waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForAlert(then: Function, onTimeout?: Function, timeout?: number): Casper;
waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForUrl(url: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForUrl(url: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper;
@@ -157,10 +172,12 @@ interface CasperOptions {
pageSettings?: any;
remoteScripts?: any[];
safeLogs?: boolean;
silentErrors?: boolean;
stepTimeout?: number;
timeout?: number;
verbose?: boolean;
viewportSize?: any;
retryTimeout?: number;
waitTimeout?: number;
}
@@ -200,6 +217,9 @@ interface Tester {
assertExists(selector: string, message?: string): any;
assertFalsy(subject: any, message?: string): any;
assertField(inputName: string, expected: string, message?: string): any;
assertFieldName(inputName: string, expected: string, message?: string, options?: any): any;
assertFieldCSS(cssSelector: string, expected: string, message?: string): any;
assertFieldXPath(xpathSelector: string, expected: string, message?: string): any;
assertHttpStatus(status: number, message?: string): any;
assertMatch(subject: any, pattern: RegExp, message?: string): any;
assertNot(subject: any, message?: string): any;
@@ -216,6 +236,7 @@ interface Tester {
assertTitleMatch(pattern: RegExp, message?: string): any;
assertTruthy(subject: any, message?: string): any;
assertType(input: any, type: string, message?: string): any;
assertInstanceOf(input: any, ctor: Function, message?: string): any;
assertUrlMatch(pattern: string, message?: string): any;
assertUrlMatch(pattern: RegExp, message?: string): any;
assertVisible(selector: string, message?: string): any;
@@ -237,6 +258,10 @@ interface Tester {
info(message: string): any;
pass(message: string): any;
renderResults(exit: boolean, status: number, save: string): any;
setup(fn: Function): any;
skip(nb: number, message: string): any;
tearDown(fn: Function): any;
}
interface Cases {
+9 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Chrome extension development.
// Project: http://developer.chrome.com/extensions/
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>
// Definitions by: Matthew Kimber <https://github.com/matthewkimber> and otiai10 <https://github.com/otiai10>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
////////////////////
@@ -775,6 +775,14 @@ declare module chrome.downloads {
export function resume(downloadId: number, callback?: Function): void;
export function cancel(downloadId: number, callback?: Function): void;
export function download(options: DownloadOptions, callback?: (downloadId: number) => void): void;
export function open(downloadId: number): void;
export function show(downloadId: number): void;
export function showDefaultFolder(): void;
export function erase(query: DownloadQuery, callback: (results: DownloadItem[]) => void): void;
export function removeFile(downloadId: number, callback: () => void): void;
export function acceptDanger(downloadId: number, callback: () => void): void;
export function drag(downloadId: number): void;
export function setShelfEnabled(enabled: boolean): void;
var onChanged: DownloadChangedEvent;
var onCreated: DownloadCreatedEvent;
+9
View File
@@ -0,0 +1,9 @@
import clone = require("clone");
var original = {
key: "value"
};
var copy = clone(original);
copy = clone(original, false);
copy = clone(original, true);
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for clone 0.1.11
// Project: https://github.com/pvorb/node-clone
// Definitions by: Kieran Simpson <https://github.com/kierans/DefinitelyTyped>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* See clone JS source for API docs
*/
declare module "clone" {
/**
* @param parent
* @param circular If not given, defaults to true in JS lib.
*/
function clone(parent: Object, circular?: boolean): Object
export = clone
}
+229
View File
@@ -0,0 +1,229 @@
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/// <reference path="cordova.d.ts"/>
// Apache Cordova core
//----------------------------------------------------------------------
console.log('cordova.version: ' + cordova.version + ', cordova.platformId: ' + cordova.platformId);
cordova.exec(null, null, "NativeClassName", "MethodName");
cordova.define('mymodule', (require, exports, module) => { });
var myModule = cordova.require('mymodule');
var argsCheck: ArgsCheck = <ArgsCheck>cordova.require('cordova/argcheck');
argsCheck.checkArgs('ssA', 'cordova.exec', [() => { }, () => { }, 'window', 'openDatabase']);
// Battery status plugin
//----------------------------------------------------------------------
window.addEventListener('batterystatus',
(ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); });
window.addEventListener('batterycritical',
()=> { alert('Battery is critical low!'); });
// Camera plugin
//----------------------------------------------------------------------
navigator.camera.getPicture(
(data: string) => { alert('Got photo!'); },
(message: string)=> { alert('Failed!: ' + message); },
{
allowEdit: true,
cameraDirection: Camera.Direction.BACK,
destinationType: Camera.DestinationType.FILE_URI,
encodingType: Camera.EncodingType.JPEG,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
quality: 80
});
// Contacts plugin
//----------------------------------------------------------------------
var contact: Contact = navigator.contacts.create({
nickname: 'John Smith',
displayName: 'John Smith',
phoneNumbers: [{ pref: true, type: "work", value: "+185642556856" }]
});
navigator.contacts.find(["phoneNumbers"],
(contacts: Contact[])=> { alert('Find ' + contacts.length + ' contacts'); },
(error: ContactError) => { alert('Error: ' + error.message); },
{
filter: "+1",
multiple: true
}
);
// Device API
//----------------------------------------------------------------------
console.log(JSON.stringify(device));
// DeviceMotion plugin
//----------------------------------------------------------------------
navigator.accelerometer.getCurrentAcceleration(
(acc: Acceleration) => { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
() => { alert('Error!'); });
var acchandle: WatchHandle = navigator.accelerometer.watchAcceleration(
(acc: Acceleration)=> { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
() => { alert('Error!'); },
{ frequency: 10 });
navigator.accelerometer.clearWatch(acchandle);
// DeviceOrientation plugin
//----------------------------------------------------------------------
navigator.compass.getCurrentHeading(
(heading: CompassHeading)=> { console.log('Got heading to ' + heading.magneticHeading); },
(error: CompassError)=> { alert('Error! ' + error.code); },
{ frequency: 10 });
var accelhandle = navigator.compass.watchHeading(
(heading: CompassHeading) => { console.log('Got heading to ' + heading.magneticHeading); },
(error: CompassError) => { alert('Error! ' + error.code); },
{ frequency: 10 });
navigator.compass.clearWatch(accelhandle);
// Dialogs plugin
//----------------------------------------------------------------------
navigator.notification.alert('Alert!', () => { alert('You\'re alerted'); }, 'Alert', 'Ok');
navigator.notification.confirm('Are you ok?', (choice: number) => { alert('Your choice is ' + choice); });
// FileSystem plugin
//----------------------------------------------------------------------
function fsaccessor(fs: FileSystem) {
console.log('FS root is: ' + fs.root.name);
var fsreader: DirectoryReader = fs.root.createReader();
fsreader.readEntries(
(entries: Entry[]) => { console.log(fs.root.name + ' has ' + entries.length + ' child elements'); },
(err: Error)=> { alert('Error: ' + err.message); });
}
window.requestFileSystem(
window.TEMPORARY,
1024 * 1024 * 5,
fsaccessor,
(err: Error) => { alert('Error: ' + err.message); });
// FileTransfer plugin
//----------------------------------------------------------------------
var file = new FileTransfer();
file.download('http://some.server.com/download.php',
'cdvfile://localhost/persistent/path/to/downloads/',
(file: FileEntry)=> { console.log('File Downloaded to ' + file.fullPath); },
(err: FileTransferError)=> { alert('Error ' + err.code); },
{ headers: null },
true);
// InAppBrowser plugin
//----------------------------------------------------------------------
// signature of window.open() added by InAppBrowser plugin
// is similar to native window.open signature, so the compiler can's
// select proper overload, but we cast result to InAppBrowser manually.
var iab = <InAppBrowser>window.open('google.com', '_self');
iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
iab.show();
// Globalization plugin
//----------------------------------------------------------------------
navigator.globalization.dateToString(new Date(),
(date) => { console.log(JSON.stringify(date)); },
(error) => { alert(error.message); },
{ formatLength: "short", selector: "date" });
navigator.globalization.getDateNames(
(names) => {
names.value.forEach((name) => { console.log(name); });
},
(error) => { alert(error.message); },
{ item: "months", type: "wide" });
// Media and Media Capture
//----------------------------------------------------------------------
var media = new Media('',
() => { console.log('Media opened'); },
(err: MediaError) => { alert('Error: ' + err.code); });
media.play();
media.setVolume(10);
console.log('Supported audio modes are: ' + JSON.stringify(navigator.device.capture.supportedAudioModes));
navigator.device.capture.captureAudio(
(captures: MediaFile[])=> { console.log(captures.length + ' captured'); },
(err: CaptureError)=> { alert('Error ' + err.message); },
{
limit: 3,
duration: 10
});
// Push Notifications
//----------------------------------------------------------------------
var pushNotification = window.plugins.pushNotification;
pushNotification.register(
(regId: string) => { console.log('Successfully registered'); },
(err: any) => { alert('Error!'); },
{
channelName: "your_channel_name",
ecb: "onNotification"
});
function onNotification(e: any) {
navigator.notification.alert(e.text2, () => { }, e.text1);
}
window.plugins.pushNotification.unregister(() => { }, () => { });
// Network Plugin
//----------------------------------------------------------------------
console.log('Connection type is: ' + navigator.connectionSpeed);
var connType = navigator.connection.type;
if (connType == Connection.WIFI) {
console.log('Congratulations, you\'re with fast Internet!');
}
document.addEventListener('offline', () => { alert('You\'re offline!'); });
// SplashScreen plugin
//----------------------------------------------------------------------
navigator.splashscreen.show();
navigator.splashscreen.hide();
// WebSQL plugin
//----------------------------------------------------------------------
var db = window.openDatabase('Test', '0.1', 'test', 1024 * 1024 * 5);
db.transaction(
(tx: SqlTransaction) => {
tx.executeSql('CREATE TABLE Sample IF NOT EXIST...');
tx.executeSql('INSERT INTO Sample VALUES...');
},
(err: SqlError) => {
if (err.code = SqlError.SYNTAX_ERR) {
alert('Error ' + err.message);
}
},
() => { console.log('Transaction completed successfully'); }
);
// Vibration plugin
//----------------------------------------------------------------------
navigator.notification.vibrate(100);
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for Apache Cordova.
// Project: http://cordova.apache.org
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/// <reference path="plugins/BatteryStatus.d.ts"/>
/// <reference path="plugins/Camera.d.ts"/>
/// <reference path="plugins/Contacts.d.ts"/>
/// <reference path="plugins/Device.d.ts"/>
/// <reference path="plugins/DeviceMotion.d.ts"/>
/// <reference path="plugins/DeviceOrientation.d.ts"/>
/// <reference path="plugins/Dialogs.d.ts"/>
/// <reference path="plugins/FileSystem.d.ts"/>
/// <reference path="plugins/FileTransfer.d.ts"/>
/// <reference path="plugins/Globalization.d.ts"/>
/// <reference path="plugins/InAppBrowser.d.ts"/>
/// <reference path="plugins/Media.d.ts"/>
/// <reference path="plugins/MediaCapture.d.ts"/>
/// <reference path="plugins/NetworkInformation.d.ts"/>
/// <reference path="plugins/Push.d.ts"/>
/// <reference path="plugins/Splashscreen.d.ts"/>
/// <reference path="plugins/Vibration.d.ts"/>
/// <reference path="plugins/WebSQL.d.ts"/>
interface Cordova {
/** Invokes native functionality by specifying corresponding service name, action and optional parameters.
* @param success A success callback function.
* @param fail An error callback function.
* @param service The service name to call on the native side (corresponds to a native class).
* @param action The action name to call on the native side (generally corresponds to the native class method).
* @param args An array of arguments to pass into the native environment.
*/
exec(success: () => any, fail: () => any, service: string, action: string, args?: string[]): void;
/** Gets the operating system name. */
platformId: string;
/** Gets Cordova framework version */
version: string;
/** Defines custom logic as a Cordova module. Other modules can later access it using module name provided. */
define(moduleName: string, factory: (require: any, exports: any, module: any) => any): void;
/** Access a Cordova module by name. */
require(moduleName: string): any;
}
// cordova/argscheck module
interface ArgsCheck {
checkArgs(argsSpec: string, functionName: string, args: any[], callee?: any): void;
getValue(value?: any, defaultValue?: any): any;
enableChecks: boolean;
}
// cordova/urlutil module
interface UrlUtil {
makeAbsolute(url: string): string
}
/** Apache Cordova instance */
declare var cordova: Cordova;
+125
View File
@@ -0,0 +1,125 @@
// Type definitions for Apache Cordova BatteryStatus plugin.
// Project: https://github.com/apache/cordova-plugin-battery-status
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
onbatterystatus: (type: BatteryStatusEvent) => void;
onbatterycritical: (type: BatteryStatusEvent) => void;
onbatterylow: (type: BatteryStatusEvent) => void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Adds a listener for an event from the BatteryStatus plugin.
* @param type the event to listen for
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param listener the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void;
/**
* Removes a listener for an event from the BatteryStatus plugin.
* @param type The event to stop listening for.
* batterystatus: event fires when the percentage of battery charge
* changes by at least 1 percent, or if the device is plugged in or unplugged.
* batterycritical: event fires when the percentage of battery charge has reached
* the critical battery threshold. The value is device-specific.
* batterylow: event fires when the percentage of battery charge has
* reached the low battery threshold, device-specific value.
* @param callback the function that executes when the event fires. The function is
* passed an BatteryStatusEvent object as a parameter.
*/
removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void;
}
/** Object, that passed into battery event listener */
interface BatteryStatusEvent extends Event {
/* The percentage of battery charge (0-100). */
level: number;
/* A boolean that indicates whether the device is plugged in. */
isPlugged: boolean;
}
+167
View File
@@ -0,0 +1,167 @@
// Type definitions for Apache Cordova Camera plugin.
// Project: https://github.com/apache/cordova-plugin-camera
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides an API for taking pictures and for choosing images from the system's image library.
*/
camera: Camera;
}
/**
* This plugin provides an API for taking pictures and for choosing images from the system's image library.
*/
interface Camera {
/**
* Removes intermediate photos taken by the camera from temporary storage.
* @param onSuccess Success callback, that called when cleanup succeeds.
* @param onError Error callback, that get an error message.
*/
cleanup(
onSuccess: () => void,
onError: (message: string) => void): void;
/**
* Takes a photo using the camera, or retrieves a photo from the device's image gallery.
* @param cameraSuccess Success callback, that get the image
* as a base64-encoded String, or as the URI for the image file.
* @param cameraError Error callback, that get an error message.
* @param cameraOptions Optional parameters to customize the camera settings.
*/
getPicture(
cameraSuccess: (data: string) => void,
cameraError: (message: string) => void,
cameraOptions?: CameraOptions): void;
// Next will work only on iOS
//getPicture(
// cameraSuccess: (data: string) => void,
// cameraError: (message: string) => void,
// cameraOptions?: CameraOptions): CameraPopoverHandle;
}
interface CameraOptions {
/** Picture quality in range o-100 */
quality?: number;
/**
* Choose the format of the return value.
* Defined in navigator.camera.DestinationType
* DATA_URL : 0, Return image as base64-encoded string
* FILE_URI : 1, Return image file URI
* NATIVE_URI : 2 Return image native URI
* (e.g., assets-library:// on iOS or content:// on Android)
*/
destinationType?: number;
/**
* Set the source of the picture. Defined in navigator.camera.PictureSourceType
* PHOTOLIBRARY : 0,
* CAMERA : 1,
* SAVEDPHOTOALBUM : 2
*/
sourceType?: number;
/** Allow simple editing of image before selection. */
allowEdit?: boolean;
/**
* Choose the returned image file's encoding. Defined in navigator.camera.EncodingType
* JPEG : 0 Return JPEG encoded image
* PNG : 1 Return PNG encoded image
*/
encodingType?: number;
/**
* Width in pixels to scale image. Must be used with targetHeight.
* Aspect ratio remains constant.
*/
targetWidth?: number;
/**
* Height in pixels to scale image. Must be used with targetWidth.
* Aspect ratio remains constant.
*/
targetHeight?: number;
/**
* Set the type of media to select from. Only works when PictureSourceType
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
* Will return format specified via DestinationType
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
* ALLMEDIA : 2 allow selection from all media types
*/
mediaType?: number;
/** Rotate the image to correct for the orientation of the device during capture. */
correctOrientation?: boolean;
/** Save the image to the photo album on the device after capture. */
saveToPhotoAlbum?: boolean;
/** Choose the camera to use (front- or back-facing). Defined in navigator.camera.Direction */
cameraDirection?: number;
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
popoverOptions?: CameraPopoverOptions;
}
/**
* A handle to the popover dialog created by navigator.camera.getPicture. Used on iOS only.
*/
interface CameraPopoverHandle {
/**
* Set the position of the popover.
* @param popoverOptions the CameraPopoverOptions that specify the new position.
*/
setPosition(popoverOptions: CameraPopoverOptions): void;
}
/**
* iOS-only parameters that specify the anchor element location and arrow direction
* of the popover when selecting images from an iPad's library or album.
*/
interface CameraPopoverOptions {
x: number;
y: number;
width: number;
height: number;
/**
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
* Matches iOS UIPopoverArrowDirection constants.
* ARROW_UP : 1,
* ARROW_DOWN : 2,
* ARROW_LEFT : 4,
* ARROW_RIGHT : 8,
* ARROW_ANY : 15
*/
arrowDir : number;
}
declare var Camera: {
// Camera constants, defined in Camera plugin
DestinationType: {
DATA_URL: number;
FILE_URI: number;
NATIVE_URI: number
}
Direction: {
BACK: number;
FRONT: number;
}
EncodingType: {
JPEG: number;
PNG: number;
}
MediaType: {
PICTURE: number;
VIDEO: number;
ALLMEDIA: number;
}
PictureSourceType: {
PHOTOLIBRARY: number;
CAMERA: number;
SAVEDPHOTOALBUM: number;
}
// Used only on iOS
PopoverArrowDirection: {
ARROW_UP: number;
ARROW_DOWN: number;
ARROW_LEFT: number;
ARROW_RIGHT: number;
ARROW_ANY: number;
}
};
+262
View File
@@ -0,0 +1,262 @@
// Type definitions for Apache Cordova Contacts plugin.
// Project: https://github.com/apache/cordova-plugin-contacts
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** Provides access to the device contacts database. */
contacts: Contacts;
}
interface Contacts {
/**
* The navigator.contacts.create method is synchronous, and returns a new Contact object.
* This method does not retain the Contact object in the device contacts database,
* for which you need to invoke the Contact.save method.
* @param properties Object with contact fields
*/
create(properties?: ContactProperties): Contact;
/**
* The navigator.contacts.find method executes asynchronously, querying the device contacts database
* and returning an array of Contact objects. The resulting objects are passed to the onSuccess
* callback function specified by the onSuccess parameter.
* @param fields The fields parameter specifies the fields to be used as a search qualifier,
* and only those results are passed to the onSuccess callback function. A zero-length fields parameter
* is invalid and results in ContactError.INVALID_ARGUMENT_ERROR. A contactFields value of "*" returns all contact fields.
* @param onSuccess Success callback function invoked with the array of Contact objects returned from the database
* @param onError Error callback function, invoked when an error occurs.
* @param options Search options to filter navigator.contacts.
*/
find(fields: string[],
onSuccess: (contacts: Contact[]) => void,
onError: (error: ContactError) => void,
options?: ContactFindOptions): void;
}
interface ContactProperties {
/** A globally unique identifier. */
id?: string;
/** The name of this Contact, suitable for display to end users. */
displayName?: string;
/** An object containing all components of a persons name. */
name?: ContactName;
/** A casual name by which to address the contact. */
nickname?: string;
/** An array of all the contact's phone numbers. */
phoneNumbers?: ContactField[];
/** An array of all the contact's email addresses. */
emails?: ContactField[];
/** An array of all the contact's addresses. */
addresses?: ContactAddress[];
/** An array of all the contact's IM addresses. */
ims?: ContactField[];
/** An array of all the contact's organizations. */
organizations?: ContactOrganization[];
/** The birthday of the contact. */
birthday?: Date;
/** A note about the contact. */
note?: string;
/** An array of the contact's photos. */
photos?: ContactField[];
/** An array of all the user-defined categories associated with the contact. */
categories?: ContactField[];
/** An array of web pages associated with the contact. */
urls?: ContactField[];
}
/**
* The Contact object represents a user's contact. Contacts can be created, stored, or removed
* from the device contacts database. Contacts can also be retrieved (individually or in bulk)
* from the database by invoking the navigator.contacts.find method.
*/
interface Contact extends ContactProperties {
/**
* Returns a new Contact object that is a deep copy of the calling object, with the id property set to null
*/
clone(): Contact;
/**
* Removes the contact from the device contacts database, otherwise executes an error callback with a ContactError object.
* @param onSuccess Success callback function invoked on success operation.
* @param onError Error callback function, invoked when an error occurs.
*/
remove(
onSuccess: () => void,
onError: (error: Error) => void): void;
/**
* Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same id already exists.
* @param onSuccess Success callback function invoked on success operation with che Contact object.
* @param onError Error callback function, invoked when an error occurs.
*/
save(
onSuccess: (contact: Contact) => void,
onError: (error: Error) => void): void;
}
declare var Contact: {
/** Constructor of Contact object */
new(id?: string,
displayName?: string,
name?: ContactName,
nickname?: string,
phoneNumbers?: ContactField[],
emails?: ContactField[],
addresses?: ContactAddress[],
ims?: ContactField[],
organizations?: ContactOrganization[],
birthday?: Date,
note?: string,
photos?: ContactField[],
categories?: ContactField,
urls?: ContactField[]): Contact
};
/** The ContactError object is returned to the user through the contactError callback function when an error occurs. */
interface ContactError {
/** Error code */
code: number;
/** Error message */
message: string;
}
declare var ContactError: {
new(code: number): ContactError;
UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number;
TIMEOUT_ERROR: number;
PENDING_OPERATION_ERROR: number;
IO_ERROR: number;
NOT_SUPPORTED_ERROR: number;
PERMISSION_DENIED_ERROR: number
};
/** Contains different kinds of information about a Contact object's name. */
interface ContactName {
/** The complete name of the contact. */
formatted?: string;
/** The contact's family name. */
familyName?: string;
/** The contact's given name. */
givenName?: string;
/** The contact's middle name. */
middleName?: string;
/** The contact's prefix (example Mr. or Dr.) */
honorifixPrefix?: string;
/** The contact's suffix (example Esq.). */
honorifixSuffix?: string;
}
declare var ContactName: {
/** Constructor for ContactName object */
new(formatted?: string,
familyName?: string,
givenName?: string,
middleName?: string,
honorifixPrefix?: string,
honorifixSuffix?: string): ContactName
};
/**
* The ContactField object is a reusable component that represents contact fields generically.
* Each ContactField object contains a value, type, and pref property. A Contact object stores
* several properties in ContactField[] arrays, such as phone numbers and email addresses.
*
* In most instances, there are no pre-determined values for a ContactField object's type attribute.
* For example, a phone number can specify type values of home, work, mobile, iPhone,
* or any other value that is supported by a particular device platform's contact database.
* However, for the Contact photos field, the type field indicates the format of the returned image:
* url when the value attribute contains a URL to the photo image, or base64 when the value
* contains a base64-encoded image string.
*/
interface ContactField {
/** Set to true if this ContactField contains the user's preferred value. */
pref: boolean;
/** A string that indicates what type of field this is, home for example. */
type: string;
/** The value of the field, such as a phone number or email address. */
value: string;
}
declare var ContactField: {
/** Constructor for ContactField object */
new(type?: string,
pref?: boolean,
value?: string): ContactField
};
/**
* The ContactAddress object stores the properties of a single address of a contact.
* A Contact object may include more than one address in a ContactAddress[] array.
*/
interface ContactAddress {
/** Set to true if this ContactAddress contains the user's preferred value. */
pref?: boolean;
/** A string indicating what type of field this is, home for example. */
type?: string;
/** The full address formatted for display. */
formatted?: string;
/** The full street address. */
streetAddress?: string;
/** The city or locality. */
locality?: string;
/** The state or region. */
region?: string;
/** The zip code or postal code. */
postalCode?: string;
/** The country name. */
country?: string;
}
declare var ContactAddress: {
/** Constructor of ContactAddress object */
new(pref?: boolean,
type?: string,
formatted?: string,
streetAddress?: string,
locality?: string,
region?: string,
postalCode?: string,
country?: string): ContactAddress
};
/**
* The ContactOrganization object stores a contact's organization properties. A Contact object stores
* one or more ContactOrganization objects in an array.
*/
interface ContactOrganization {
/** Set to true if this ContactOrganization contains the user's preferred value. */
pref?: boolean;
/** A string that indicates what type of field this is, home for example. */
type?: string;
/** The name of the organization. */
name?: string;
/** The department the contract works for. */
department?: string;
/** The contact's title at the organization. */
title?: string;
}
declare var ContactOrganization: {
/** Constructor for ContactOrganization object */
new(pref?: boolean,
type?: string,
name?: string,
department?: string,
title?: string): ContactOrganization
};
/** Search options to filter navigator.contacts. */
interface ContactFindOptions {
/** The search string used to find navigator.contacts. */
filter?: string;
/** Determines if the find operation returns multiple navigator.contacts. */
multiple?: boolean;
}
declare var ContactFindOptions: {
/** Constructor for ContactFindOptions object */
new(filter?: string,
multiple?: boolean): ContactFindOptions
};
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for Apache Cordova Device plugin.
// Project: https://github.com/apache/cordova-plugin-device
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/**
* This plugin defines a global device object, which describes the device's hardware and software.
* Although the object is in the global scope, it is not available until after the deviceready event.
*/
interface Device {
/** Get the version of Cordova running on the device. */
cordova: string;
/**
* The device.model returns the name of the device's model or product. The value is set
* by the device manufacturer and may be different across versions of the same product.
*/
model: string;
/** device.name is deprecated as of version 2.3.0. Use device.model instead. */
name: string;
/** Get the device's operating system name. */
platform: string;
/** Get the device's Universally Unique Identifier (UUID). */
uuid: string;
/** Get the operating system version. */
version: string;
}
declare var device: Device;
+77
View File
@@ -0,0 +1,77 @@
// Type definitions for Apache Cordova Device Motion plugin.
// Project: https://github.com/apache/cordova-plugin-device-motion
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor
* that detects the change (delta) in movement relative to the current device orientation,
* in three dimensions along the x, y, and z axis.
*/
accelerometer: Accelerometer;
}
/**
* This plugin provides access to the device's accelerometer. The accelerometer is a motion sensor
* that detects the change (delta) in movement relative to the current device orientation,
* in three dimensions along the x, y, and z axis.
*/
interface Accelerometer {
/**
* Stop watching the Acceleration referenced by the watchID parameter.
* @param watchID The ID returned by navigator.accelerometer.watchAcceleration.
*/
clearWatch(watchID: WatchHandle): void;
/**
* Get the current acceleration along the x, y, and z axes.
* These acceleration values are returned to the accelerometerSuccess callback function.
* @param accelerometerSuccess Success callback that gets the Acceleration object.
* @param accelerometerError Success callback
*/
getCurrentAcceleration(
accelerometerSuccess: (acceleration: Acceleration) => void,
accelerometerError: () => void): void;
/**
* Retrieves the device's current Acceleration at a regular interval, executing the
* accelerometerSuccess callback function each time. Specify the interval in milliseconds
* via the acceleratorOptions object's frequency parameter.
* The returned watch ID references the accelerometer's watch interval, and can be used
* with navigator.accelerometer.clearWatch to stop watching the accelerometer.
* @param accelerometerSuccess Callback, that called at every time interval and passes an Acceleration object.
* @param accelerometerError Error callback.
* @param accelerometerOptions Object with options for watchAcceleration
*/
watchAcceleration(
accelerometerSuccess: (acceleration: Acceleration) => void,
accelerometerError: () => void,
accelerometerOptions?: AccelerometerOptions): WatchHandle;
}
/**
* Contains Accelerometer data captured at a specific point in time. Acceleration values include
* the effect of gravity (9.81 m/s^2), so that when a device lies flat and facing up, x, y, and z
* values returned should be 0, 0, and 9.81.
*/
interface Acceleration {
/** Amount of acceleration on the x-axis. (in m/s^2) */
x: number;
/** Amount of acceleration on the y-axis. (in m/s^2) */
y: number;
/** Amount of acceleration on the z-axis. (in m/s^2) */
z: number;
/** Creation timestamp in milliseconds. */
timestamp: number;
}
/** Object with options for watchAcceleration */
interface AccelerometerOptions {
/** How often to retrieve the Acceleration in milliseconds. (Default: 10000) */
frequency?: number;
}
/** Abstract type for watch IDs used by Accelerometer. Values of these type are actually `number` at runtime.*/
interface WatchHandle { }
+86
View File
@@ -0,0 +1,86 @@
// Type definitions for Apache Cordova Device Orientation plugin.
// Project: https://github.com/apache/cordova-plugin-device-orientation
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides access to the device's compass. The compass is a sensor that detects
* the direction or heading that the device is pointed, typically from the top of the device.
* It measures the heading in degrees from 0 to 359.99, where 0 is north.
*/
compass: Compass;
}
/**
* This plugin provides access to the device's compass. The compass is a sensor that detects
* the direction or heading that the device is pointed, typically from the top of the device.
* It measures the heading in degrees from 0 to 359.99, where 0 is north.
*/
interface Compass {
/**
* Get the current compass heading. The compass heading is returned via a CompassHeading
* object using the onSuccess callback function.
* @param onSuccess Success callback that passes CompassHeading object.
* @param onError Error callback that passes CompassError object.
*/
getCurrentHeading(
onSuccess: (heading: CompassHeading) => void,
onError: (error: CompassError) => void,
options?: CompassOptions): void;
/**
* Gets the device's current heading at a regular interval. Each time the heading is retrieved,
* the headingSuccess callback function is executed. The returned watch ID references the compass
* watch interval. The watch ID can be used with navigator.compass.clearWatch to stop watching
* the navigator.compass.
* @param onSuccess Success callback that passes CompassHeading object.
* @param onError Error callback that passes CompassError object.
* @param options CompassOptions object
*/
watchHeading(
onSuccess: (heading: CompassHeading) => void,
onError: (error: CompassError) => void,
options?: CompassOptions): number;
/**
* Stop watching the compass referenced by the watch ID parameter.
* @param id The ID returned by navigator.compass.watchHeading.
*/
clearWatch(id: number): void;
}
/** A CompassHeading object is returned to the compassSuccess callback function. */
interface CompassHeading {
/** The heading in degrees from 0-359.99 at a single moment in time. */
magneticHeading: number;
/** The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. */
trueHeading: number;
/** The deviation in degrees between the reported heading and the true heading. */
headingAccuracy: number;
/** The time at which this heading was determined. */
timestamp: number;
}
interface CompassOptions {
filter?: number;
frequency?: number;
}
/** A CompassError object is returned to the onError callback function when an error occurs. */
interface CompassError {
/**
* One of the predefined error codes
* CompassError.COMPASS_INTERNAL_ERR
* CompassError.COMPASS_NOT_SUPPORTED
*/
code: number;
}
declare var CompassError: {
/** Constructor for CompassError object */
new(code: number): CompassError;
COMPASS_INTERNAL_ERR: number;
COMPASS_NOT_SUPPORTED: number
}
+66
View File
@@ -0,0 +1,66 @@
// Type definitions for Apache Cordova Dialogs plugin.
// Project: https://github.com/apache/cordova-plugin-dialogs
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** This plugin provides access to some native dialog UI elements. */
notification: Notification
}
/** This plugin provides access to some native dialog UI elements. */
interface Notification {
/**
* Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature,
* but some platforms use the browser's alert function, which is typically less customizable.
* @param message Dialog message.
* @param alertCallback Callback to invoke when alert dialog is dismissed.
* @param title Dialog title, defaults to 'Alert'.
* @param buttonName Button name, defaults to OK.
*/
alert(message: string,
alertCallback: () => void,
title?: string,
buttonName?: string): void;
/**
* The device plays a beep sound.
* @param times The number of times to repeat the beep.
*/
beep(times: number): void;
/**
* Displays a customizable confirmation dialog box.
* @param message Dialog message.
* @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3)
* or when the dialog is dismissed without a button press (0).
* @param title Dialog title, defaults to Confirm.
* @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel].
*/
confirm(message: string,
confirmCallback: (choice: number) => void,
title?: string,
buttonLabels?: string[]): void;
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param message Dialog message.
* @param promptCallback Callback to invoke when a button is pressed.
* @param title Dialog title, defaults to "Prompt".
* @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"].
* @param defaultText Default textbox input value, default: "".
*/
prompt(message: string,
promptCallback: (result: NotificationPromptResult) => void,
title?: string,
buttonLabels?: string[],
defaultText?: string): void;
}
/** Object, passed to promptCallback */
interface NotificationPromptResult {
/** The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc. */
buttonIndex: number;
/** The text entered in the prompt dialog box. */
input1: string;
}
+294
View File
@@ -0,0 +1,294 @@
// Type definitions for Apache Cordova File System plugin.
// Project: https://github.com/apache/cordova-plugin-file
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
/**
* Requests a filesystem in which to store application data.
* @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT.
* @param size This is an indicator of how much storage space, in bytes, the application expects to need.
* @param successCallback The callback that is called when the user agent provides a filesystem.
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
*/
requestFileSystem(
type: number,
size: number,
successCallback: (fileSystem: FileSystem) => void,
errorCallback?: (fileError: Error) => void): void;
TEMPORARY: number;
PERSISTENT: number;
}
/** This interface represents a file system. */
interface FileSystem {
/**
* Constructor for FileSystem object
* @param name This is the name of the file system. The specifics of naming filesystems
* is unspecified, but a name must be unique across the list of exposed file systems.
* @param root The root directory of the file system.
*/
new (name: string, root: DirectoryEntry)
/**
* This is the name of the file system. The specifics of naming filesystems
* is unspecified, but a name must be unique across the list of exposed file systems.
*/
name: string;
/** The root directory of the file system. */
root: DirectoryEntry;
}
/**
* An abstract interface representing entries in a file system,
* each of which may be a File or DirectoryEntry.
*/
interface Entry {
/** Constructor for Entry object */
new ( isFile: boolean, isDirectory: boolean, name: string, fullPath: string, fileSystem: FileSystem, nativeURL: string) ;
/** Entry is a file. */
isFile: boolean;
/** Entry is a directory. */
isDirectory: boolean;
/** The name of the entry, excluding the path leading to it. */
name: string;
/** The full absolute path from the root to the entry. */
fullPath: string;
/** The file system on which the entry resides. */
fileSystem: FileSystem;
nativeURL: string;
/**
* Look up metadata about this entry.
* @param successCallback A callback that is called with the time of the last modification.
* @param errorCallback A callback that is called when errors happen.
*/
getMetadata(
successCallback: (metadata: Metadata) => void,
errorCallback?: (error: Error) => void): void;
/**
* Move an entry to a different location on the file system. It is an error to try to:
* move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided;
* move a file to a path occupied by a directory;
* move a directory to a path occupied by a file;
* move any element to a path occupied by a directory which is not empty.
* A move of a file on top of an existing file must attempt to delete and replace that file.
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
* @param parent The directory to which to move the entry.
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
* @param successCallback A callback that is called with the Entry for the new location.
* @param errorCallback A callback that is called when errors happen.
*/
moveTo(parent: DirectoryEntry,
newName?: string,
successCallback?: (entry: Entry) => void ,
errorCallback?: (error: Error) => void ): void;
/**
* Copy an entry to a different location on the file system. It is an error to try to:
* copy a directory inside itself or to any child at any depth;
* copy an entry into its parent if a name different from its current one isn't provided;
* copy a file to a path occupied by a directory;
* copy a directory to a path occupied by a file;
* copy any element to a path occupied by a directory which is not empty.
* A copy of a file on top of an existing file must attempt to delete and replace that file.
* A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.
* Directory copies are always recursive--that is, they copy all contents of the directory.
* @param parent The directory to which to move the entry.
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
* @param successCallback A callback that is called with the Entry for the new object.
* @param errorCallback A callback that is called when errors happen.
*/
copyTo(parent: DirectoryEntry,
newName?: string,
successCallback?: (entry: Entry) => void ,
errorCallback?: (error: Error) => void ): void;
toURL(): string;
/**
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
* @param successCallback A callback that is called on success.
* @param errorCallback A callback that is called when errors happen.
*/
remove(successCallback: () => void ,
errorCallback?: (error: Error) => void ): void;
/**
* Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.
* @param successCallback A callback that is called with the time of the last modification.
* @param errorCallback A callback that is called when errors happen.
*/
getParent(successCallback: (entry: Entry) => void ,
errorCallback?: (error: Error) => void ): void;
}
/** This interface supplies information about the state of a file or directory. */
interface Metadata {
/** This is the time at which the file or directory was last modified. */
modificationTime: Date;
/** The size of the file, in bytes. This must return 0 for directories. */
size: number;
}
/** This interface represents a directory on a file system. */
interface DirectoryEntry extends Entry {
/**
* Creates a new DirectoryReader to read Entries from this Directory.
*/
createReader(): DirectoryReader;
/**
* Creates or looks up a file.
* @param path Either an absolute path or a relative path from this DirectoryEntry
* to the file to be looked up or created.
* It is an error to attempt to create a file whose immediate parent does not yet exist.
* @param options If create and exclusive are both true, and the path already exists, getFile must fail.
* If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.
* If create is not true and the path doesn't exist, getFile must fail.
* If create is not true and the path exists, but is a directory, getFile must fail.
* Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
* @param successCallback A callback that is called to return the File selected or created.
* @param errorCallback A callback that is called when errors happen.
*/
getFile(path: string, options?: Flags,
successCallback?: (entry: FileEntry) => void,
errorCallback?: (error: Error) => void): void;
/**
* Creates or looks up a directory.
* @param path Either an absolute path or a relative path from this DirectoryEntry
* to the directory to be looked up or created.
* It is an error to attempt to create a directory whose immediate parent does not yet exist.
* @param options If create and exclusive are both true and the path already exists, getDirectory must fail.
* If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.
* If create is not true and the path doesn't exist, getDirectory must fail.
* If create is not true and the path exists, but is a file, getDirectory must fail.
* Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
* @param successCallback A callback that is called to return the Directory selected or created.
* @param errorCallback A callback that is called when errors happen.
*/
getDirectory(path: string, options?: Flags,
successCallback?: (entry: DirectoryEntry) => void,
errorCallback?: (error: Error) => void): void;
/**
* Deletes a directory and all of its contents, if any. In the event of an error (e.g. trying
* to delete a directory that contains a file that cannot be removed), some of the contents
* of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
* @param successCallback A callback that is called on success.
* @param errorCallback A callback that is called when errors happen.
*/
removeRecursively(successCallback: () => void,
errorCallback?: (error: Error) => void): void;
}
/**
* This dictionary is used to supply arguments to methods
* that look up or create files or directories.
*/
interface Flags {
/** Used to indicate that the user wants to create a file or directory if it was not previously there. */
create?: boolean;
/** By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists. */
exclusive?: boolean;
}
/**
* This interface lets a user list files and directories in a directory. If there are
* no additions to or deletions from a directory between the first and last call to
* readEntries, and no errors occur, then:
* A series of calls to readEntries must return each entry in the directory exactly once.
* Once all entries have been returned, the next call to readEntries must produce an empty array.
* If not all entries have been returned, the array produced by readEntries must not be empty.
* The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
*/
interface DirectoryReader {
/**
* Read the next block of entries from this directory.
* @param successCallback Called once per successful call to readEntries to deliver the next
* previously-unreported set of Entries in the associated Directory.
* If all Entries have already been returned from previous invocations
* of readEntries, successCallback must be called with a zero-length array as an argument.
* @param errorCallback A callback indicating that there was an error reading from the Directory.
*/
readEntries(successCallback: (entries: Entry[]) => void, errorCallback?: (error: Error) => void): void;
}
/** This interface represents a file on a file system. */
interface FileEntry extends Entry {
/**
* Creates a new FileWriter associated with the file that this FileEntry represents.
* @param successCallback A callback that is called with the new FileWriter.
* @param errorCallback A callback that is called when errors happen.
*/
createWriter(successCallback: (
writer: FileWriter) => void,
errorCallback?: (error: Error) => void): void;
/**
* Returns a File that represents the current state of the file that this FileEntry represents.
* @param successCallback A callback that is called with the File.
* @param errorCallback A callback that is called when errors happen.
*/
file(successCallback: (file: File) => void,
errorCallback?: (error: Error) => void): void;
}
/**
* This interface provides methods to monitor the asynchronous writing of blobs
* to disk using progress events and event handler attributes.
*/
interface FileSaver extends EventTarget {
/** Terminate file operation */
abort(): void;
/**
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting,
* must return the current state, which must be one of the following values:
* INIT
* WRITING
* DONE
*/
readyState: number;
/** Handler for writestart events. */
onwritestart: (event: ProgressEvent) => void;
/** Handler for progress events. */
onprogress: (event: ProgressEvent) => void;
/** Handler for write events. */
onwrite: (event: ProgressEvent) => void;
/** Handler for abort events. */
onabort: (event: ProgressEvent) => void;
/** Handler for error events. */
onerror: (event: ProgressEvent) => void;
/** Handler for writeend events. */
onwriteend: (event: ProgressEvent) => void;
/** The last error that occurred on the FileSaver. */
error: Error;
}
/**
* This interface expands on the FileSaver interface to allow for multiple write
* actions, rather than just saving a single Blob.
*/
interface FileWriter extends FileSaver {
/**
* The byte offset at which the next write to the file will occur. This must be no greater than length.
* A newly-created FileWriter must have position set to 0.
*/
position: number;
/**
* The length of the file. If the user does not have read access to the file,
* this must be the highest byte offset at which the user has written.
*/
length: number;
/**
* Write the supplied data to the file at position.
* @param {Blob} data The blob to write.
*/
write(data: Blob): void;
/**
* The file position at which the next write will occur.
* @param offset If nonnegative, an absolute byte offset into the file.
* If negative, an offset back from the end of the file.
*/
seek(offset: number): void;
/**
* Changes the length of the file to that specified. If shortening the file, data beyond the new length
* must be discarded. If extending the file, the existing data must be zero-padded up to the new length.
* @param size The size to which the length of the file is to be adjusted, measured in bytes.
*/
truncate(size: number): void;
}
+129
View File
@@ -0,0 +1,129 @@
// Type definitions for Apache Cordova FileTransfer plugin.
// Project: https://github.com/apache/cordova-plugin-file-transfer
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
/// <reference path="FileSystem.d.ts"/>
/**
* The FileTransfer object provides a way to upload files using an HTTP multi-part POST request,
* and to download files as well.
*/
interface FileTransfer {
/** Called with a ProgressEvent whenever a new chunk of data is transferred. */
onprogress: Function;
/**
* Sends a file to a server.
* @param fileURL Filesystem URL representing the file on the device. For backwards compatibility,
* this can also be the full path of the file on the device.
* @param server URL of the server to receive the file, as encoded by encodeURI().
* @param successCallback A callback that is passed a FileUploadResult object.
* @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
* Invoked with a FileTransferError object.
* @param options Optional parameters.
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
* This is useful since Android rejects self-signed security certificates.
* Not recommended for production use. Supported on Android and iOS.
*/
upload(
fileURL: string,
server: string,
successCallback: (result: FileUploadResult) => void,
errorCallback: (error: FileTransferError) => void,
options?: FileUploadOptions,
trustAllHosts?: boolean): void;
/**
* downloads a file from server.
* @param source URL of the server to download the file, as encoded by encodeURI().
* @param target Filesystem url representing the file on the device. For backwards compatibility,
* this can also be the full path of the file on the device.
* @param successCallback A callback that is passed a FileEntry object. (Function)
* @param errorCallback A callback that executes if an error occurs when retrieving the fileEntry.
* Invoked with a FileTransferError object.
* @param options Optional parameters.
* @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates.
* This is useful since Android rejects self-signed security certificates.
* Not recommended for production use. Supported on Android and iOS.
*/
download(
source: string,
target: string,
successCallback: (fileEntry: FileEntry) => void,
errorCallback: (error: FileTransferError) => void,
options?: FileDownloadOptions,
trustAllHosts?: boolean): void;
/**
* Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object
* which has an error code of FileTransferError.ABORT_ERR.
*/
abort(): void;
}
declare var FileTransfer: {
new (): FileTransfer;
};
/** A FileUploadResult object is passed to the success callback of the FileTransfer object's upload() method. */
interface FileUploadResult {
/** The number of bytes sent to the server as part of the upload. */
bytesSent: number;
/** The HTTP response code returned by the server. */
responseCode: number;
/** The HTTP response returned by the server. */
response: string;
/** The HTTP response headers by the server. Currently supported on iOS only.*/
headers: any;
}
/** Optional parameters for upload method. */
interface FileUploadOptions {
/** The name of the form element. Defaults to file. */
fileKey?: string;
/** The file name to use when saving the file on the server. Defaults to image.jpg. */
fileName?: string;
/** The mime type of the data to upload. Defaults to image/jpeg. */
mimeType?: string;
/** A set of optional key/value pairs to pass in the HTTP request. */
params?: Object;
/** Whether to upload the data in chunked streaming mode. Defaults to true. */
chunkedMode?: boolean;
/** A map of header name/header values. Use an array to specify more than one value. */
headers?: Object[];
}
/** Optional parameters for download method. */
interface FileDownloadOptions {
/** A map of header name/header values. Use an array to specify more than one value. */
headers?: Object[];
}
/** A FileTransferError object is passed to an error callback when an error occurs. */
interface FileTransferError {
/**
* One of the predefined error codes listed below.
* FileTransferError.FILE_NOT_FOUND_ERR
* FileTransferError.INVALID_URL_ERR
* FileTransferError.CONNECTION_ERR
* FileTransferError.ABORT_ERR
*/
code: number;
/** URL to the source. */
source: string;
/** URL to the target. */
target: string;
/** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */
http_status: number;
body: any;
}
declare var FileTransferError: {
/** Constructor for FileTransferError object */
new (code?: number, source?: string, target?: string, status?: number, body?: any): FileTransferError;
FILE_NOT_FOUND_ERR: number;
INVALID_URL_ERR: number;
CONNECTION_ERR: number;
ABORT_ERR: number;
}
+255
View File
@@ -0,0 +1,255 @@
// Type definitions for Apache Cordova Globalization plugin.
// Project: https://github.com/apache/cordova-plugin-globalization
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** This plugin obtains information and performs operations specific to the user's locale and timezone. */
globalization: Globalization
}
/** This plugin obtains information and performs operations specific to the user's locale and timezone. */
interface Globalization {
/**
* Get the string identifier for the client's current language.
* @param onSuccess Called on success getting the language with a properties object,
* that should have a value property with a String value.
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
*/
getPreferredLanguage(
onSuccess: (language: { value: string; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Get the string identifier for the client's current locale setting.
* @param onSuccess Called on success getting the locale identifier with a properties object,
* that should have a value property with a String value.
* @param onError Called on error getting the locale identifier with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN\_ERROR.
*/
getLocaleName(
onSuccess: (locale: { value: string; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Returns a date formatted as a string according to the client's locale and timezone.
* @param date Date to format.
* @param onSuccess Called on success with a properties object,
* that should have a value property with a String value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'}
*/
dateToString(
date: Date,
onSuccess: (date: { value: string; }) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Parses a date formatted as a string, according to the client's user preferences
* and calendar using the time zone of the client, and returns the corresponding date object.
* @param dateString String to parse
* @param onSuccess Called on success with GlobalizationDate object
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.PARSING_ERROR.
* @param options Optional parse parameters. Default {formatLength:'short', selector:'date and time'}
*/
stringToDate(
dateString: string,
onSuccess: (date: GlobalizationDate) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Returns a pattern string to format and parse dates according to the client's user preferences.
* @param onSuccess Called on success getting pattern with a GlobalizationDatePattern object
* @param onError Called on error getting pattern with a GlobalizationError object.
* The error's expected code is GlobalizationError.PATTERN_ERROR.
* @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'}
*/
getDatePattern(
onSuccess: (datePattern: GlobalizationDatePattern) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
* @param onSuccess Called on success getting names with a properties object,
* that should have a value property with a String[] value.
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
* @param options Optional parameters. Default: {type:'wide', item:'months'}
*/
getDateNames(
onSuccess: (names: { value: string[]; }) => void,
onError: (error: GlobalizationError) => void,
options?: { type?: string; item?: string; }): void;
/**
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
* @param {Date} date Date to check
* @param onSuccess Called on success with a properties object,
* that should have a dst property with a boolean value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
*/
isDaylightSavingsTime(
date: Date,
onSuccess: (result: { dst: boolean; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Returns the first day of the week according to the client's user preferences and calendar.
* @param onSuccess Called on success with a day object,
* that should have a value property with a number value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.UNKNOWN_ERROR.
*/
getFirstDayOfWeek(
onSuccess: (day: { value: number; }) => void,
onError: (error: GlobalizationError) => void): void;
/**
* Returns a number formatted as a string according to the client's user preferences.
* @param value Number to format
* @param onSuccess Called on success with a result object,
* that should have a value property with a String value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param format Optional format parameters. Default: {type:'decimal'}
*/
nubmerToString(
value: number,
onSuccess: (result: { value: string; }) => void,
onError: (error: GlobalizationError) => void,
format?: { type?: string; }): void;
/**
* Parses a number formatted as a string according to the client's user preferences and returns the corresponding number.
* @param value String to parse
* @param onSuccess Called on success with a result object,
* that should have a value property with a number value.
* @param onError Called on error with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param format Optional format parameters. Default: {type:'decimal'}
*/
stringToNumber(
value: string,
onSuccess: (result: { value: number; }) => void,
onError: (error: GlobalizationError) => void,
format?: { type?: string; }): void;
/**
* Returns a pattern string to format and parse numbers according to the client's user preferences.
* @param onSuccess Called on success getting pattern with a GlobalizationNumberPattern object
* @param onError Called on error getting the language with a GlobalizationError object.
* The error's expected code is GlobalizationError.PATTERN_ERROR.
* @param options Optional format parameters. Default {type:'decimal'}.
*/
getNumberPattern(
onSuccess: (result: GlobalizationNumberPattern) => void,
onError: (error: GlobalizationError) => void,
format?: { type?: string; }): void;
/**
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
* @param currencyCode Should be a String of one of the ISO 4217 currency codes, for example 'USD'.
* @param onSuccess Called on success getting pattern with a GlobalizatioCurrencyPattern object
* @param onError Called on error getting pattern with a GlobalizationError object.
* The error's expected code is GlobalizationError.FORMATTING_ERROR.
* @param options Optional format parameters. Default {type:'decimal'}.
*/
getCurrencyPattern(
currencyCode: string,
onSuccess: (result: GlobalizationCurrencyPattern) => void,
onError: (error: GlobalizationError) => void): void;
}
/** Date returned by stringToDate */
interface GlobalizationDate {
/* The four digit year. */
year: number;
/* The month from (0-11). */
month: number;
/* The day from (1-31). */
day: number;
/* The hour from (0-23). */
hour: number;
/* The minute from (0-59). */
minute: number;
/* The second from (0-59). */
second: number;
/* The milliseconds (from 0-999), not available on all platforms. */
millisecond: number;
}
/** Pattern to format and parse dates according to the client's user preferences.*/
interface GlobalizationDatePattern {
/* The date and time pattern to format and parse dates. The patterns follow Unicode Technical Standard #35. */
pattern: string;
/* The abbreviated name of the time zone on the client. */
timezone: string;
/* The current difference in seconds between the client's time zone and coordinated universal time. */
utc_offset: number;
/* The current daylight saving time offset in seconds between the client's non-daylight saving's time zone and the client's daylight saving's time zone. */
dst_offset: number;
}
interface GlobalizationDateNameOptions {
type?: string;
item?: string;
}
/** Pattern to format and parse numbers according to the client's user preferences. */
interface GlobalizationNumberPattern {
/* The number pattern to format and parse numbers. The patterns follow Unicode Technical Standard #35. */
pattern: string;
/* The symbol to use when formatting and parsing, such as a percent or currency symbol. */
symbol: string;
/* The number of fractional digits to use when parsing and formatting numbers. */
fraction: number;
/* The rounding increment to use when parsing and formatting. */
rounding: number;
/* The symbol to use for positive numbers when parsing and formatting. */
positive: string;
/* The symbol to use for negative numbers when parsing and formatting. */
negative: string;
/* The decimal symbol to use for parsing and formatting. */
decimal: string;
/* The grouping symbol to use for parsing and formatting. */
grouping: string;
}
/**
* Pattern to format and parse currency values according
* to the client's user preferences and ISO 4217 currency code.
*/
interface GlobalizationCurrencyPattern {
/** The currency pattern to format and parse currency values. The patterns follow Unicode Technical Standard #35. */
pattern: string;
/** The ISO 4217 currency code for the pattern. */
code: string;
/** The number of fractional digits to use when parsing and formatting currency. */
fraction: number;
/** The rounding increment to use when parsing and formatting. */
rounding: number;
/** The decimal symbol to use for parsing and formatting. */
decimal: string;
/** The grouping symbol to use for parsing and formatting. */
grouping: string;
}
/** An object representing a error from the Globalization API. */
interface GlobalizationError {
/** One of the following codes representing the error type:
* GlobalizationError.UNKNOWN_ERROR: 0
* GlobalizationError.FORMATTING_ERROR: 1
* GlobalizationError.PARSING_ERROR: 2
* GlobalizationError.PATTERN_ERROR: 3
*/
code: number;
/** A text message that includes the error's explanation and/or details */
message: string;
}
/** An object representing a error from the Globalization API. */
declare var GlobalizationError: {
UNKNOWN_ERROR: number;
FORMATTING_ERROR: number;
PARSING_ERROR: number;
PATTERN_ERROR: number;
}
+219
View File
@@ -0,0 +1,219 @@
// Type definitions for Apache Cordova InAppBrowser plugin.
// Project: https://github.com/apache/cordova-plugin-inappbrowser
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_self", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_blank", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_system", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: string, options?: string, replace?: boolean): InAppBrowser;
}
/**
* The object returned from a call to window.open.
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface InAppBrowser extends Window {
onloadstart: (type: InAppBrowserEvent) => void;
onloadstop: (type: InAppBrowserEvent) => void;
onloaderror: (type: InAppBrowserEvent) => void;
onexit: (type: InAppBrowserEvent) => void;
// addEventListener overloads
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
/**
* Adds a listener for an event from the InAppBrowser.
* @param type the event to listen for
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: string, callback: (event: InAppBrowserEvent) => void): void;
// removeEventListener overloads
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
/**
* Removes a listener for an event from the InAppBrowser.
* @param type The event to stop listening for.
* loadstart: event fires when the InAppBrowser starts to load a URL.
* loadstop: event fires when the InAppBrowser finishes loading a URL.
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
* exit: event fires when the InAppBrowser window is closed.
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: string, callback: (event: InAppBrowserEvent) => void): void;
/** Closes the InAppBrowser window. */
close(): void;
/**
* Displays an InAppBrowser window that was opened hidden. Calling this has no effect
* if the InAppBrowser was already visible.
*/
show(): void;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { code: string }, callback: (result: any) => void): void;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { file: string }, callback: (result: any) => void): void;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { code: string }, callback: () => void): void;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { file: string }, callback: () => void): void;
}
interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
type: string;
/** the URL that was loaded. */
url: string;
/** the error code, only in the case of loaderror. */
code: number;
/** the error message, only in the case of loaderror. */
message: string;
}
+86
View File
@@ -0,0 +1,86 @@
// Type definitions for Apache Cordova Media plugin.
// Project: https://github.com/apache/cordova-plugin-media
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
declare var Media: {
new (
src: string,
mediaSuccess: () => void,
mediaError?: (error: MediaError) => any,
mediaStatus?: (status: number) => void): Media;
//Media statuses
MEDIA_NONE: number;
MEDIA_STARTING: number;
MEDIA_RUNNING: number;
MEDIA_PAUSED: number;
MEDIA_STOPPED: number
};
/**
* This plugin provides the ability to record and play back audio files on a device.
* NOTE: The current implementation does not adhere to a W3C specification for media capture,
* and is provided for convenience only. A future implementation will adhere to the latest
* W3C specification and may deprecate the current APIs.
*/
interface Media {
/**
* Constructor for Media object.
* @param src A URI containing the audio content.
* @param mediaSuccess The callback that executes after a Media object has completed
* the current play, record, or stop action.
* @param mediaError The callback that executes if an error occurs.
* @param mediaStatus The callback that executes to indicate status changes.
*/
new (
src: string,
mediaSuccess: () => void,
mediaError?: (error: MediaError) => any,
mediaStatus?: (status: number) => void): Media;
/**
* Returns the current position within an audio file. Also updates the Media object's position parameter.
* @param mediaSuccess The callback that is passed the current position in seconds.
* @param mediaError The callback to execute if an error occurs.
*/
getCurrentPosition(
mediaSuccess: (position: number) => void,
mediaError?: (error: MediaError) => void): void;
/** Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. */
getDuration(): number;
/** Starts or resumes playing an audio file. */
play(): void;
/** Pauses playing an audio file. */
pause(): void;
/**
* Releases the underlying operating system's audio resources. This is particularly important
* for Android, since there are a finite amount of OpenCore instances for media playback.
* Applications should call the release function for any Media resource that is no longer needed.
*/
release(): void;
/**
* Sets the current position within an audio file.
* @param position Position in milliseconds.
*/
seekTo(position: number): void;
/**
* Set the volume for an audio file.
* @param volume The volume to set for playback. The value must be within the range of 0.0 to 1.0.
*/
setVolume(volume: number): void;
/** Starts recording an audio file. */
startRecord(): void;
/** Stops recording an audio file. */
stopRecord(): void;
/** Stops playing an audio file. */
stop(): void;
/**
* The position within the audio playback, in seconds.
* Not automatically updated during play; call getCurrentPosition to update.
*/
position: number;
/** The duration of the media, in seconds. */
duration: number;
}
+167
View File
@@ -0,0 +1,167 @@
// Type definitions for Apache Cordova MediaCapture plugin.
// Project: https://github.com/apache/cordova-plugin-media-capture
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
device: Device;
}
interface Device {
capture: Capture;
}
/** This plugin provides access to the device's audio, image, and video capture capabilities. */
interface Capture {
/**
* Start the audio recorder application and return information about captured audio clip files.
* @param onSuccess Executes when the capture operation finishes with an array
* of MediaFile objects describing each captured audio clip file.
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
* @param options Encapsulates audio capture configuration options.
*/
captureAudio(
onSuccess: (mediaFiles: MediaFile[]) => void,
onError: (error: CaptureError) => void,
options?: AudioOptions): void ;
/**
* Start the camera application and return information about captured image files.
* @param onSuccess Executes when the capture operation finishes with an array
* of MediaFile objects describing each captured image clip file.
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
* @param options Encapsulates audio capture configuration options.
*/
captureImage(
onSuccess: (mediaFiles: MediaFile[]) => void,
onError: (error: CaptureError) => void,
options?: ImageOptions): void ;
/**
* Start the video recorder application and return information about captured video clip files.
* @param onSuccess Executes when the capture operation finishes with an array
* of MediaFile objects describing each captured video clip file.
* @param onError Executes, if the user terminates the operation before an audio clip is captured,
* with a CaptureError object, featuring the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
* @param options Encapsulates audio capture configuration options.
*/
captureVideo(
onSuccess: (mediaFiles: MediaFile[]) => void,
onError: (error: CaptureError) => void,
options?: VideoOptions): void ;
/** The audio recording formats supported by the device. */
supportedAudioModes: ConfigurationData[];
/** The recording image sizes and formats supported by the device. */
supportedImageModes: ConfigurationData[];
/** The recording video resolutions and formats supported by the device. */
supportedVideoModes: ConfigurationData[];
}
/** Encapsulates properties of a media capture file. */
interface MediaFile {
/** The name of the file, without path information. */
name: string;
/** The full path of the file, including the name. */
fullPath: string;
/** The file's mime type */
type: string;
/** The date and time when the file was last modified. */
lastModifiedDate: Date;
/** The size of the file, in bytes. */
size: number;
/**
* Retrieves format information about the media capture file.
* @param successCallback Invoked with a MediaFileData object when successful.
* @param errorCallback Invoked if the attempt fails, this function.
*/
getFormatData(
successCallback: (data: MediaFileData) => void,
errorCallback?: () => void): void;
}
/** Encapsulates format information about a media file. */
interface MediaFileData {
/** The actual format of the audio and video content. */
codecs: string;
/** The average bitrate of the content. The value is zero for images. */
bitrate: number;
/** The height of the image or video in pixels. The value is zero for audio clips. */
height: number;
/** The width of the image or video in pixels. The value is zero for audio clips. */
width: number;
/** The length of the video or sound clip in seconds. The value is zero for images. */
duration: number;
}
/** Encapsulates the error code resulting from a failed media capture operation. */
interface CaptureError {
/**
* One of the pre-defined error codes listed below.
* CaptureError.CAPTURE_INTERNAL_ERR
* The camera or microphone failed to capture image or sound.
* CaptureError.CAPTURE_APPLICATION_BUSY
* The camera or audio capture application is currently serving another capture request.
* CaptureError.CAPTURE_INVALID_ARGUMENT
* Invalid use of the API (e.g., the value of limit is less than one).
* CaptureError.CAPTURE_NO_MEDIA_FILES
* The user exits the camera or audio capture application before capturing anything.
* CaptureError.CAPTURE_NOT_SUPPORTED
* The requested capture operation is not supported.
*/
code: number;
message: string;
}
declare var CaptureError: {
/** Constructor for CaptureError */
new (code: number, message: string): CaptureError;
CAPTURE_INTERNAL_ERR: number;
CAPTURE_APPLICATION_BUSY: number;
CAPTURE_INVALID_ARGUMENT: number;
CAPTURE_NO_MEDIA_FILES: number;
CAPTURE_NOT_SUPPORTED: number;
}
/** Encapsulates audio capture configuration options. */
interface AudioOptions {
/**
* The maximum number of audio clips the device's user can capture in a single
* capture operation. The value must be greater than or equal to 1.
*/
limit?: number;
/** The maximum duration of a audio clip, in seconds. */
duration?: number;
}
/** Encapsulates image capture configuration options. */
interface ImageOptions {
/**
* The maximum number of images the user can capture in a single capture operation.
* The value must be greater than or equal to 1 (defaults to 1).
*/
limit?: number;
}
/** Encapsulates video capture configuration options. */
interface VideoOptions {
/**
* The maximum number of video clips the device's user can capture in a single
* capture operation. The value must be greater than or equal to 1.
*/
limit?: number;
/** The maximum duration of a video clip, in seconds. */
duration?: number;
}
/** Encapsulates a set of media capture parameters that a device supports. */
interface ConfigurationData {
/** The ASCII-encoded lowercase string representing the media type. */
type: string;
/** The height of the image or video in pixels. The value is zero for sound clips. */
height: number;
/** The width of the image or video in pixels. The value is zero for sound clips. */
width: number;
}
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for Apache Cordova Network Information plugin.
// Project: https://github.com/apache/cordova-plugin-network-information
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/**
* This plugin provides an implementation of an old version of the Network Information API.
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
*/
connection: Connection;
// see https://github.com/apache/cordova-plugin-network-information/blob/dev/doc/index.md#api-change
// for
network: {
/**
* This plugin provides an implementation of an old version of the Network Information API.
* It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
*/
connection: Connection
}
}
interface Document {
addEventListener(type: "online", connectionStateCallback: () => any, useCapture?: boolean): void;
addEventListener(type: "offline", connectionStateCallback: () => any, useCapture?: boolean): void;
}
/**
* The connection object, exposed via navigator.connection, provides information
* about the device's cellular and wifi connection.
*/
interface Connection {
/**
* This property offers a fast way to determine the device's network connection state, and type of connection.
* One of:
* Connection.UNKNOWN
* Connection.ETHERNET
* Connection.WIFI
* Connection.CELL_2G
* Connection.CELL_3G
* Connection.CELL_4G
* Connection.CELL
* Connection.NONE
*/
type: number
}
declare var Connection: {
UNKNOWN: number;
ETHERNET: number;
WIFI: number;
CELL_2G: number;
CELL_3G: number;
CELL_4G: number;
CELL: number;
NONE: number;
}
+68
View File
@@ -0,0 +1,68 @@
// Type definitions for Apache Cordova Push plugin.
// Project: https://github.com/phonegap-build/PushPlugin
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
plugins: {
/**
* This plugin allows to receive push notifications. The Android implementation uses
* Google's GCM (Google Cloud Messaging) service,
* whereas the iOS version is based on Apple APNS Notifications
*/
pushNotification: PushNotification
}
}
/**
* This plugin allows to receive push notifications. The Android implementation uses
* Google's GCM (Google Cloud Messaging) service,
* whereas the iOS version is based on Apple APNS Notifications
*/
interface PushNotification {
/**
* Registers as push notification receiver.
* @param successCallback Called when a plugin method returns without error.
* @param errorCallback Called when the plugin returns an error.
* @param registrationOptions Options for registration process.
*/
register(
successCallback: (registrationId: string) => void,
errorCallback: (error: any) => void,
registrationOptions: RegistrationOptions): void;
/**
* Unregisters as push notification receiver.
* @param successCallback Called when a plugin method returns without error.
* @param errorCallback Called when the plugin returns an error.
*/
unregister(
successCallback: (result: any) => void,
errorCallback: (error: any) => void): void;
/**
* Sets the badge count visible when the app is not running. iOS only.
* @param successCallback Called when a plugin method returns without error.
* @param errorCallback Called when the plugin returns an error.
* @param badgeCount An integer indicating what number should show up in the badge. Passing 0 will clear the badge.
*/
setApplicationIconBadgeNumber(
successCallback: (result: any) => void,
errorCallback: (error: any) => void,
badgeCount: number): void;
}
/** Options for registration process. */
interface RegistrationOptions {
/** This is the Google project ID you need to obtain by registering your application for GCM. Android only */
senderID?: string;
/** WP8 only */
channelName?: string;
/** Callback, that is fired when notification arrived */
ecb?: string;
badge?: boolean;
sound?: boolean;
alert?: boolean
}
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for Apache Cordova Splashscreen plugin.
// Project: https://github.com/apache/cordova-plugin-splashscreen
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Navigator {
/** This plugin displays and hides a splash screen during application launch. */
splashscreen: {
/** Dismiss the splash screen. */
hide(): void;
/** Displays the splash screen. */
show(): void;
}
}
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for Apache Cordova Vibration plugin.
// Project: https://github.com/apache/cordova-plugin-vibration
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Notification {
/**
* Vibrates the device for the specified amount of time.
* @param time Milliseconds to vibrate the device. Ignored on iOS.
*/
vibrate(time: number): void
}
+103
View File
@@ -0,0 +1,103 @@
// Type definitions for Apache Cordova WebSQL plugin.
// Project: https://github.com/sgrebnov/cordova-plugin-websql
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
//
// Copyright (c) Microsoft Open Technologies, Inc.
// Licensed under the MIT license.
interface Window {
/**
* Creates (opens, if exist) database with supplied parameters.
* @param name Database name
* @param version Database version
* @param displayname Database display name
* @param size Size, in bytes
* @param creationCallback Callback, that executed on database creation. Accepts Database object.
*/
openDatabase(name: string,
version: string,
displayname: string,
size: number,
creationCallback?: (database: Database) => void): Database;
}
interface Database {
/**
* Starts new transaction.
* @param callback Function, that will be called when transaction starts.
* @param errorCallback Called, when Transaction fails.
* @param successCallback Called, when transaction committed.
*/
transaction(callback: (transaction: SqlTransaction) => void,
errorCallback?: (error: SqlError) => void,
successCallback?: () => void): void;
/**
* Starts new transaction.
* @param callback Function, that will be called when transaction starts.
* @param errorCallback Called, when Transaction fails.
* @param successCallback Called, when transaction committed.
*/
readTransaction(callback: (transaction: SqlTransaction) => void,
errorCallback?: (error: SqlError) => void,
successCallback?: () => void): void;
name: string;
version: string;
displayname: string;
size: number;
}
declare var Database: {
/** Constructor for Database object */
new(name: string,
version: string,
displayname: string,
size: number,
creationCallback: (database: Database)=> void): Database;
};
interface SqlTransaction {
/**
* Executes SQL statement via current transaction.
* @param sql SQL statement to execute.
* @param arguments SQL stetement arguments.
* @param successCallback Called in case of query has been successfully done.
* @param errorCallback Called, when query fails.
*/
executeSql(sql: string,
arguments?: any[],
successCallback?: (transaction: SqlTransaction, resultSet: SqlResultSet) => void,
errorCallback?: (transaction: SqlTransaction, error: SqlError) => void): void;
}
declare var SqlTransaction: {
new(): SqlTransaction;
};
interface SqlResultSet {
insertId: number;
rowsAffected: number;
rows: SqlResultSetRowList;
}
interface SqlResultSetRowList {
length: number;
item(index: number): Object;
}
interface SqlError {
code: number;
message: string;
}
declare var SqlError: {
// Error code constants from http://www.w3.org/TR/webdatabase/#sqlerror
UNKNOWN_ERR: number;
DATABASE_ERR: number;
VERSION_ERR: number;
TOO_LARGE_ERR: number;
QUOTA_ERR: number;
SYNTAX_ERR: number;
CONSTRAINT_ERR: number;
TIMEOUT_ERR: number;
};
+102
View File
@@ -0,0 +1,102 @@
// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1
// Project: http://www.createjs.com/#!/EaselJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>, Satoru Kimura <https://github.com/gyohk>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
Copyright (c) 2012 Pedro Ferreira
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Common class and methods for CreateJS.
// Library documentation : http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html
// Library documentation : http://www.createjs.com/Docs/PreloadJS/modules/PreloadJS.html
// Library documentation : http://www.createjs.com/Docs/SoundJS/modules/SoundJS.html
// Library documentation : http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html
declare module createjs {
export class Event {
constructor(type: string, bubbles: boolean, cancelable: boolean);
// properties
bubbles: boolean;
cancelable: boolean;
currentTarget: any; // It is 'Object' type officially, but 'any' is easier to use.
defaultPrevented: boolean;
eventPhase: number;
immediatePropagationStopped: boolean;
propagationStopped: boolean;
removed: boolean;
target: any; // It is 'Object' type officially, but 'any' is easier to use.
timeStamp: number;
type: string;
// other event payloads
data: any;
delta: number;
error: string;
id: string;
item: any;
loaded: number;
name: string;
next: string;
params: any;
paused: boolean;
progress: number;
rawResult: any;
result: any;
runTime: number;
src: string;
time: number;
total: number;
// methods
clone(): Event;
preventDefault(): void;
remove(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
toString(): string;
}
export class EventDispatcher {
constructor();
// methods
addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
dispatchEvent(eventObj: Object, target?: Object): boolean;
dispatchEvent(eventObj: string, target?: Object): boolean;
dispatchEvent(eventObj: Event, target?: Object): boolean;
hasEventListener(type: string): boolean;
static initialize(target: Object): void;
off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
removeAllEventListeners(type?: string): void;
removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
toString(): string;
willTrigger(type: string): boolean;
}
export function indexOf(array: any[], searchElement: Object): number;
export function proxy(method: (eventObj: Object) => boolean, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: (eventObj: Object) => void, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: { handleEvent: (eventObj: Object) => boolean; }, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: { handleEvent: (eventObj: Object) => void; }, scope: Object, ...arg: any[]): (eventObj: Object) => any;
}
+11 -89
View File
@@ -4,99 +4,21 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
Copyright (c) 2012 Pedro Ferreira
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Common class and methods for CreateJS.
Copyright (c) 2012 Pedro Ferreira
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Library documentation : http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html
// Library documentation : http://www.createjs.com/Docs/PreloadJS/modules/PreloadJS.html
// Library documentation : http://www.createjs.com/Docs/SoundJS/modules/SoundJS.html
// Library documentation : http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html
declare module createjs {
export class Event {
constructor(type: string, bubbles: boolean, cancelable: boolean);
/// <reference path="../createjs-lib/createjs-lib.d.ts" />
/// <reference path="../easeljs/easeljs.d.ts" />
/// <reference path="../tweenjs/tweenjs.d.ts" />
/// <reference path="../preloadjs/preloadjs.d.ts" />
/// <reference path="../soundjs/soundjs.d.ts" />
// properties
bubbles: boolean;
cancelable: boolean;
currentTarget: any; // It is 'Object' type officially, but 'any' is easier to use.
defaultPrevented: boolean;
eventPhase: number;
immediatePropagationStopped: boolean;
propagationStopped: boolean;
removed: boolean;
target: any; // It is 'Object' type officially, but 'any' is easier to use.
timeStamp: number;
type: string;
// other event payloads
data: any;
delta: number;
error: string;
id: string;
item: any;
loaded: number;
name: string;
next: string;
params: any;
paused: boolean;
progress: number;
rawResult: any;
result: any;
runTime: number;
src: string;
time: number;
total: number;
// methods
clone(): Event;
preventDefault(): void;
remove(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
toString(): string;
}
export class EventDispatcher {
constructor();
// methods
addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
dispatchEvent(eventObj: Object, target?: Object): boolean;
dispatchEvent(eventObj: string, target?: Object): boolean;
dispatchEvent(eventObj: Event, target?: Object): boolean;
hasEventListener(type: string): boolean;
static initialize(target: Object): void;
off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
removeAllEventListeners(type?: string): void;
removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
toString(): string;
willTrigger(type: string): boolean;
}
export function indexOf(array: any[], searchElement: Object): number;
export function proxy(method: (eventObj: Object) => boolean, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: (eventObj: Object) => void, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: { handleEvent: (eventObj: Object) => boolean; }, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: { handleEvent: (eventObj: Object) => void; }, scope: Object, ...arg: any[]): (eventObj: Object) => any;
}
Vendored
+87 -46
View File
@@ -54,6 +54,7 @@ declare module D3 {
y: number;
keyCode: number;
altKey: any;
type: string;
}
export interface Base extends Selectors {
@@ -528,7 +529,7 @@ declare module D3 {
/**
* gets the touch positions relative to a specified container.
*/
touches(container: any): Array<number>;
touches(container: any): Array<Array<number>>;
/**
* If the specified value is a function, returns the specified value.
@@ -1031,7 +1032,7 @@ declare module D3 {
ceil: (date: Date) => Date;
range: Range;
offset: (date: Date, step: number) => Date;
utc: Interval;
utc?: Interval;
}
export interface TimeFormat {
@@ -1066,7 +1067,7 @@ declare module D3 {
histogram(): HistogramLayout;
pack(): PackLayout;
partition(): PartitionLayout;
treeMap(): TreeMapLayout;
treemap(): TreeMapLayout;
}
export interface StackLayout {
@@ -1266,7 +1267,7 @@ declare module D3 {
}
export interface BundleLayout{
(links: Array<GraphLink>): Array<GraphNode>;
(links: Array<GraphLink>): Array<Array<GraphNode>>;
}
export interface ChordLayout {
@@ -1279,15 +1280,15 @@ declare module D3 {
(padding: number): ChordLayout;
}
sortGroups: {
(): Array<number>;
(): (a: number, b: number) => number;
(comparator: (a: number, b: number) => number): ChordLayout;
}
sortSubgroups: {
(): Array<number>;
(): (a: number, b: number) => number;
(comparator: (a: number, b: number) => number): ChordLayout;
}
sortChords: {
(): Array<GraphLink>;
(): (a: number, b: number) => number;
(comparator: (a: number, b: number) => number): ChordLayout;
}
chords(): Array<GraphLink>;
@@ -2480,7 +2481,7 @@ declare module D3 {
(values: any[]): Scale;
(): any[];
};
invertExtent(y: any): any[];
invertExtent?(y: any): any[];
copy(): Scale;
}
@@ -2579,13 +2580,31 @@ declare module D3 {
(value: number): number;
}
export interface IdentityScale extends QuantitiveScale {
export interface IdentityScale extends Scale {
/**
* Get the range value corresponding to a given domain value.
*
* @param value Domain Value
*/
(value: number): number;
/**
* Get the domain value corresponding to a given range value.
*
* @param value Range Value
*/
invert(value: number): number;
/**
* get representative values from the input domain.
*
* @param count Aproximate representative values to return.
*/
ticks(count: number): any[];
/**
* get a formatter for displaying tick values
*
* @param count Aproximate representative values to return
*/
tickFormat(count: number): (n: number) => string;
}
export interface SqrtScale extends QuantitiveScale {
@@ -2910,11 +2929,11 @@ declare module D3 {
/**
* create a standard projection from a raw projection.
*/
projection(raw: (lambda: any, phi: any) => any): Projection;
projection(raw: RawProjection): Projection;
/**
* create a standard projection from a mutable raw projection.
*/
projectionMutator(rawFactory: (lambda: number, phi: number) => Array<number>): Projection;
projectionMutator(rawFactory: RawProjection): ProjectionMutator;
/**
* the Albers equal-area conic projection.
*/
@@ -2928,82 +2947,82 @@ declare module D3 {
*/
azimuthalEqualArea: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the azimuthal equidistant projection.
*/
azimuthalEquidistant: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the conic conformal projection.
*/
conicConformal: {
(): Projection;
raw(): Projection;
raw(phi1:number, phi2:number): RawProjection;
}
/**
* the conic equidistant projection.
*/
conicEquidistant: {
(): Projection;
raw(): Projection;
raw(phi1:number, phi2:number): RawProjection;
}
/**
* the conic equal-area (a.k.a. Albers) projection.
*/
conicEqualArea: {
(): Projection;
raw(): Projection;
raw(phi1:number, phi2:number): RawProjection;
}
/**
* the equirectangular (plate carreé) projection.
*/
equirectangular: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the gnomonic projection.
*/
gnomonic: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the spherical Mercator projection.
*/
mercator: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the azimuthal orthographic projection.
*/
othographic: {
orthographic: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the azimuthal stereographic projection.
*/
stereographic: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the transverse Mercator projection.
*/
transverseMercator: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* convert a GeoJSON object to a geometry stream.
*/
stream(object: GeoJSON, listener: any): Stream;
stream(object: GeoJSON, listener: Stream): void;
/**
*
*/
@@ -3011,7 +3030,7 @@ declare module D3 {
/**
*
*/
greatArc: GreatArc;
greatArc(): GreatArc;
/**
*
*/
@@ -3107,7 +3126,7 @@ declare module D3 {
export interface Graticule{
(): GeoJSON;
lines(): GeoJSON;
lines(): Array<GeoJSON>;
outline(): GeoJSON;
extent: {
(): Array<Array<number>>;
@@ -3161,9 +3180,14 @@ declare module D3 {
type: string;
}
export interface RawProjection {
(lambda: number, phi: number): Array<number>;
invert?(x: number, y: number): Array<number>;
}
export interface Projection {
(coordinates: Array<number>): Array<number>;
invert(point: Array<number>): Array<number>;
invert?(point: Array<number>): Array<number>;
rotate: {
(): Array<number>;
(rotation: Array<number>): Projection;
@@ -3196,7 +3220,7 @@ declare module D3 {
(): number;
(precision: number): Projection;
};
stream(listener?: any): Stream;
stream(listener?: Stream): Stream;
}
export interface Stream {
@@ -3212,6 +3236,10 @@ declare module D3 {
(location: Array<number>): Rotation;
invert(location: Array<number>): Rotation;
}
export interface ProjectionMutator {
(lambda: number, phi: number): Projection;
}
}
// Geometry
@@ -3229,15 +3257,25 @@ declare module D3 {
/**
* constructs a quadtree for an array of points.
*/
quadtree: Quadtree;
quadtree(): QuadtreeFactory;
/**
* constructs a polygon
* Constructs a new quadtree for the specified array of points.
*/
polygon: Polygon;
quadtree(points: Array<Point>, x1: number, y1: number, x2: number, y2: number): Quadtree;
/**
* Constructs a new quadtree for the specified array of points.
*/
quadtree(points: Array<Point>, width: number, height: number): Quadtree;
/**
* Returns the input array of vertices with additional methods attached
*/
polygon(vertices:Array<Vertice>): Polygon;
/**
* creates a new hull layout with the default settings.
*/
hull: Hull;
hull(): Hull;
hull(vertices:Array<Vertice>): Array<Vertice>;
}
export interface Vertice extends Array<number> {
@@ -3248,10 +3286,6 @@ declare module D3 {
}
export interface Polygon extends Array<Vertice> {
/**
* Returns the input array of vertices with additional methods attached
*/
(vertices: Array<Vertice>): Polygon;
/**
* Returns the signed area of this polygon
*/
@@ -3266,7 +3300,7 @@ declare module D3 {
clip(subject: Polygon): Polygon;
}
export interface Quadtree {
export interface QuadtreeFactory {
/**
* Constructs a new quadtree for the specified array of points.
*/
@@ -3279,22 +3313,29 @@ declare module D3 {
* Constructs a new quadtree for the specified array of points.
*/
(points: Array<Point>, width: number, height: number): Quadtree;
/**
* Adds a new point to the quadtree.
*/
add(point: Point): Quadtree;
visit(callback: any): Quadtree;
x: {
(): (d: any) => any;
(accesor: (d: any) => any): Quadtree;
(accesor: (d: any) => any): QuadtreeFactory;
}
y: {
(): (d: any) => any;
(accesor: (d: any) => any): Quadtree;
(accesor: (d: any) => any): QuadtreeFactory;
}
size(size: Array<number>): Quadtree;
size(): Array<number>;
size(size: Array<number>): QuadtreeFactory;
extent(): Array<Array<number>>;
extent(points: Array<Array<number>>): QuadtreeFactory;
}
export interface Quadtree {
/**
* Adds a new point to the quadtree.
*/
add(point: Point): void;
visit(callback: any): void;
}
export interface Point {
@@ -3382,7 +3423,7 @@ declare module D3 {
}
export interface Hull {
(vertices: Array<Vertice>): Hull;
(vertices: Array<Vertice>): Array<Vertice>;
x: {
(): (d: any) => any;
(accesor: (d: any) => any): any;
+3 -3
View File
@@ -10,7 +10,7 @@ declare module D3 {
interface SuperformulaType
{
(any): any;//hans
(any: any): any;//hans
m: number;
n1: number;
n2: number;
@@ -22,7 +22,7 @@ declare module D3 {
interface Superformula
{
(): any;
type(any): any;
type(any: any): any;
param(name: string, value: number): Superformula;
size(x: number): Superformula;
segments(x: number): Superformula;
@@ -35,4 +35,4 @@ declare module D3 {
superformulaPath: SuperformulaPath;
superformulaTypes: SuperformulaType[];
}
}
}
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="./diff.d.ts" />
import jsdiff = require('diff');
var one = 'beep boop';
var other = 'beep boob blah';
var diff = jsdiff.diffChars(one, other);
diff.forEach(function (part) {
var mark = part.added ? '+' :
part.removed ? '-' : ' ';
console.log(mark + " " + part.value);
});
// --------------------------
class LineDiffWithoutWhitespace extends jsdiff.Diff {
tokenize(value:string):any {
return value.split(/^/m);
}
equals(left:string, right:string):boolean {
return left.trim() === right.trim();
}
}
var obj = new LineDiffWithoutWhitespace(true);
var diff = obj.diff(one, other);
printDiff(diff);
function printDiff(diff:jsdiff.IDiffResult[]) {
function addLineHeader(decorator:string, str:string) {
return str.split("\n").map((line, index, array) => {
if (index === array.length - 1 && line === "") {
return line;
} else {
return decorator + line;
}
}).join("\n");
}
diff.forEach((part)=> {
if (part.added) {
console.log(addLineHeader("+", part.value));
} else if (part.removed) {
console.log(addLineHeader("-", part.value));
} else {
console.log(addLineHeader(" ", part.value));
}
});
}
+57
View File
@@ -0,0 +1,57 @@
// Type definitions for diff
// Project: https://github.com/kpdecker/jsdiff
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module JsDiff {
interface IDiffResult {
value: string;
added?: boolean;
removed?: boolean;
}
interface IBestPath {
newPos: number;
componenets: IDiffResult[];
}
class Diff {
ignoreWhitespace:boolean;
constructor(ignoreWhitespace?:boolean);
diff(oldString:string, newString:string):IDiffResult[];
pushComponent(components:IDiffResult[], value:string, added:boolean, removed:boolean):void;
extractCommon(basePath:IBestPath, newString:string, oldString:string, diagonalPath:number):number;
equals(left:string, right:string):boolean;
join(left:string, right:string):string;
tokenize(value:string):any; // return types are string or string[]
}
function diffChars(oldStr:string, newStr:string):IDiffResult[];
function diffWords(oldStr:string, newStr:string):IDiffResult[];
function diffWordsWithSpace(oldStr:string, newStr:string):IDiffResult[];
function diffLines(oldStr:string, newStr:string):IDiffResult[];
function diffCss(oldStr:string, newStr:string):IDiffResult[];
function createPatch(fileName:string, oldStr:string, newStr:string, oldHeader:string, newHeader:string):string;
function applyPatch(oldStr:string, uniDiff:string):string;
function convertChangesToXML(changes:IDiffResult[]):string;
function convertChangesToDMP(changes:IDiffResult[]):{0: number; 1:string;}[];
}
declare module "diff" {
export = JsDiff;
}
+2 -2
View File
@@ -12,10 +12,10 @@
// Library documentation : http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html
/// <reference path="../createjs/createjs.d.ts" />
/// <reference path="../createjs-lib/createjs-lib.d.ts" />
/// <reference path="../tweenjs/tweenjs.d.ts" />
// rename the native MouseEvent, to avoid conflit with createjs's MouseEvent
// rename the native MouseEvent, to avoid conflict with createjs's MouseEvent
interface NativeMouseEvent extends MouseEvent {
}
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="./emissary.d.ts" />
import emissary = require("emissary");
var Emitter = emissary.Emitter;
var emitter = new Emitter();
emitter.on('foo', ()=>{});
emitter.emit('a');
emitter.getSubscriptionCount('b');
emitter.on('b-subscription-added', (handler:any) =>{});
emitter.emit('b', 'b2');
emitter.off('foo', ()=>{});
emitter.signal('a');
var Subscriber = emissary.Subscriber;
var subscriber = new Subscriber();
subscriber.subscribe(emitter, 'event1', ()=>{});
subscriber.unsubscribe();
subscriber.unsubscribe(emitter);
+51
View File
@@ -0,0 +1,51 @@
// Type definitions for emissary
// Project: https://github.com/atom/emissary
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../mixto/mixto.d.ts" />
declare module Emissary {
interface IEmitterStatic extends Mixto.IMixinStatic {
new ():IEmitter;
}
interface IEmitter {
on(eventNames:string, handler:Function):any; // return value type are Signal
once(eventName:string, handler:Function):any; // return value type are Signal
signal(eventName:string):void;
behavior(eventName:string, initialValue:any):void;
emit(eventName:string, ...args:any[]):void;
off(eventNames:string, handler:Function):void;
pauseEvents(eventNames:string):void;
resumeEvents(eventNames:string):void;
incrementSubscriptionCount(eventName:string):number;
decrementSubscriptionCount(eventName:string):number;
getSubscriptionCount(eventName:string):number;
hasSubscriptions(eventName:string):boolean;
}
interface ISubscriberStatic extends Mixto.IMixinStatic {
new ():ISubscriber;
}
interface ISubscriber {
subscribeWith(eventEmitter:any, methodName:string, args:any):any;
addSubscription(subscription:any):any;
subscribe(eventEmitterOrSubscription:any, ...args:any[]):any;
subscribeToCommand(eventEmitter:any, ...args:any[]):any;
unsubscribe(object?:any):any;
}
}
declare module "emissary" {
var Emitter:Emissary.IEmitterStatic;
var Subscriber:Emissary.ISubscriberStatic;
var Signal:Function; // TODO
var Behavior:Function; // TODO
var combine:Function; // TODO
}
+21 -4
View File
@@ -12,6 +12,17 @@
/// <reference path="../node/node.d.ts" />
declare module Express {
// These open interfaces may be extended in an application-specific manner via declaration merging.
// See for example passport.d.ts (https://github.com/borisyankov/DefinitelyTyped/blob/master/passport/passport.d.ts)
export interface Request { }
export interface Response { }
export interface Application { }
}
declare module "express" {
import http = require('http');
@@ -229,7 +240,7 @@ declare module "express" {
count: number;
}
interface Request {
interface Request extends Express.Request {
session: Session;
@@ -258,7 +269,7 @@ declare module "express" {
header(name: string): string;
headers: string[];
headers: { [key: string]: string; };
/**
* Check if the given `type(s)` is acceptable, returning
@@ -545,7 +556,7 @@ declare module "express" {
(body: any): Response;
}
interface Response extends http.ServerResponse {
interface Response extends http.ServerResponse, Express.Response {
/**
* Set status `code`.
*
@@ -893,7 +904,7 @@ declare module "express" {
(req: Request, res: Response, next: Function): any;
}
interface Application extends IRouter<Application> {
interface Application extends IRouter<Application>, Express.Application {
/**
* Initialize the server.
*
@@ -967,6 +978,12 @@ declare module "express" {
* @param val
*/
set (setting: string, val: string): Application;
get(name: string): string;
get(name: string, ...handlers: RequestFunction[]): Application;
get(name: RegExp, ...handlers: RequestFunction[]): Application;
/**
* Return the app's absolute pathname
+1
View File
@@ -24,6 +24,7 @@ declare class Animation {
duration(value:number):any;
eventCallback(type:string, callback?:Function, params?:any[], scope?:any):any;
invalidate():any;
isActive():boolean;
kill(vars?:Object, target?:Object):any;
pause(atTime?:any, suppressEvents?:boolean):any;
paused(value?:boolean):any;
+32 -15
View File
@@ -1,32 +1,49 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="hammerjs.d.ts" />
var hammer = new Hammer(document.getElementById("container"));
hammer.ondragstart = function (ev) { };
hammer.ondrag = function (ev) { };
hammer.ondragend = function (ev) { };
hammer.onswipe = function (ev) { };
// plugin check
if (!Hammer.HAS_TOUCHEVENTS && !Hammer.HAS_POINTEREVENTS) {
Hammer.plugins.fakeMultitouch();
Hammer.plugins.showTouches();
}
hammer.ontap = function (ev) { };
hammer.ondoubletap = function (ev) { };
hammer.onhold = function (ev) { };
// instance method check
var el = document.getElementById("container");
hammer.ontransformstart = function (ev) { };
hammer.ontransform = function (ev) { };
hammer.ontransformend = function (ev) { };
Hammer(el).on("doubletap", function () {
alert('you doubletapped me!');
});
hammer.onrelease = function (ev) { };
var hammertime = Hammer(el, {
drag: false,
transform: false
}).off("tap", function (event:HammerEvent) {
alert('hello!');
});
hammertime.enable(false);
hammertime.on("touch drag transform", function (ev: HammerEvent) {
if (!ev.gesture) {
return;
}
if (ev.gesture.deltaX >= 20) {
hammertime.trigger("swipe", ev.gesture);
}
});
// jQuery check
$("#element")
.hammer({
// Options
})
.bind("tap", function (ev) {
.on("tap", function (ev) {
console.log(ev);
});
$("#container").hammer({
prevent_default: false,
drag_vertical: false
}).bind("hold tap doubletap transformstart transform transformend dragstart drag dragend release swipe", function (ev) {
drag_block_vertical: false
}).on("hold tap doubletap transformstart transform transformend dragstart drag dragend release swipe", function (ev) {
});
+79 -31
View File
@@ -1,4 +1,4 @@
// Type definitions for Hammer.js 1.0.5
// Type definitions for Hammer.js 1.0.10
// Project: http://eightmedia.github.com/hammer.js/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -6,6 +6,46 @@
/// <reference path="../jquery/jquery.d.ts"/>
declare var Hammer: HammerStatic;
interface HammerStatic {
(element: any, options?: HammerOptions): HammerInstance;
VERSION: number;
HAS_POINTEREVENTS: boolean;
HAS_TOUCHEVENTS: boolean;
UPDATE_VELOCITY_INTERVAL: number;
POINTER_MOUSE: HammerPointerType;
POINTER_TOUCH: HammerPointerType;
POINTER_PEN: HammerPointerType;
DIRECTION_UP: HammerDirectionType;
DIRECTION_DOWN: HammerDirectionType;
DIRECTION_LEFT: HammerDirectionType;
DIRECTION_RIGH: HammerDirectionType;
EVENT_START: HammerTouchEventState;
EVENT_MOVE: HammerTouchEventState;
EVENT_END: HammerTouchEventState;
plugins: any;
gestures: any;
READY: boolean;
}
declare class HammerInstance {
constructor(element: any, options?: HammerOptions);
on(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
off(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
enable(toggle: boolean): HammerInstance;
// You shouldn't use this, this is an internally method use by the gestures. Only use it when you know what you're doing! You can read the sourcecode about how to use this.
trigger(gesture: string, eventData: HammerGestureEventData): HammerInstance;
}
// Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options
interface HammerOptions {
drag?: boolean;
@@ -38,44 +78,52 @@ interface HammerOptions {
transform_min_scale?: number;
}
interface HammerGestureEventData {
timestamp: number;
target: HTMLElement;
touches: HammerPoint[];
pointerType: HammerPointerType;
center: HammerPoint;
deltaTime: number;
deltaX: number;
deltaY: number;
velocityX: number;
velocityY: number;
angle: number;
interimAngle: number;
direction: HammerDirectionType;
interimDirection: HammerDirectionType;
distance: number;
scale: number;
rotation: number;
eventType: HammerTouchEventState;
srcEvent: any;
startEvent: any;
stopPropagation(): void;
preventDefault(): void;
stopDetect(): void;
}
interface HammerPoint {
x: number;
y: number;
pageX: number;
pageY: number;
}
interface HammerEvent {
originalEvent: Event;
position: HammerPoint;
touches: HammerPoint[];
type: string;
gesture: HammerGestureEventData;
stopPropagation(): void;
preventDefault(): void;
}
interface HammertTransformEvent extends HammerEvent {
scale: number;
rotation: number;
declare enum HammerPointerType {
}
interface HammerDirectionEvent extends HammerEvent {
angle: number;
direction: string;
distance: number;
distanceX: number;
distanceY: number;
declare enum HammerDirectionType {
}
declare class Hammer {
constructor (element: any, options?: HammerOptions);
ondragstart: (event: HammerDirectionEvent) => void;
ondrag: (event: HammerDirectionEvent) => void;
ondragend: (event: HammerDirectionEvent) => void;
onswipe: (event: HammerDirectionEvent) => void;
ontap: (event: HammerEvent) => void;
ondoubletap: (event: HammerEvent) => void;
onhold: (event: HammerEvent) => void;
ontransformstart: (event: HammertTransformEvent) => void;
ontransform: (event: HammertTransformEvent) => void;
ontransformend: (event: HammertTransformEvent) => void;
onrelease: (event: HammerEvent) => void;
declare enum HammerTouchEventState {
}
interface JQuery {
+32
View File
@@ -0,0 +1,32 @@
/// <reference path="hellojs.d.ts" />
hello.init(
{
'facebook': '<app key>',
},
{
redirect_uri: 'hello.html',
display: 'page',
}
);
hello('facebook').login();
hello('facebook').logout();
hello.on('auth.login', auth => {
alert('log to ' + auth.network)
}).on('auth.logout', auth => {
alert('unlog from ' + auth.network)
});
hello.getAuthResponse('facebook');
hello.login('facebook', null, () => {
var req = hello.getAuthResponse('facebook');
});
hello.logout('facebook');
var serviceInfo = hello.service('facebook');
+67
View File
@@ -0,0 +1,67 @@
// Type definitions for hello.js 0.2.1
// Project: http://adodson.com/hello.js/
// Definitions by: Pavel Zika <https://github.com/PavelPZ>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface HelloJSLoginOptions {
redirect_uri?: string;
display?: string;
scope?: string;
response_type?: string;
force?: boolean;
oauth_proxy?: string;
timeout?: number;
default_service?: string;
}
interface HelloJSEventArgument {
network: string;
authResponse?: any;
}
interface HelloJSStatic {
init(serviceAppIds: { [id: string]: string; }, defaultOptions?: HelloJSLoginOptions):void;
login(network: string, option?: HelloJSLoginOptions, callback?: () => void): void;
logout(network: string, callback?: () => void): void;
on(eventName: string, event: (auth: HelloJSEventArgument) => void): HelloJSStatic;
off(eventName: string, event: (auth: HelloJSEventArgument) => void): HelloJSStatic;
getAuthResponse(network: string): any;
service(network: string): HelloJSServiceDef;
settings: HelloJSLoginOptions;
(network: string): HelloJSStaticNamed;
init(servicesDef: { [id: string]: HelloJSServiceDef; }): void;
}
interface HelloJSStaticNamed {
login(option?: HelloJSLoginOptions, callback?: () => void): void;
logout(callback?: () => void): void;
getAuthResponse(): any;
}
interface HelloJSOAuthDef {
version: number;
auth: string;
request: string;
token: string;
}
interface HelloJSServiceDef {
name: string;
oauth: HelloJSOAuthDef;
scope?: { [id: string]: string; };
scope_delim?: string;
autorefresh?: boolean;
base?: string;
root?: string;
get?: { [id: string]: any; }
post?: { [id: string]: any; }
del?: { [id: string]: string; }
put?: { [id: string]: any; }
wrap?: { [id: string]: (par: any) => void; }
xhr?: (par: any) => void;
jsonp?: (par: any) => void;
form?: (par: any) => void;
api?: (...par: any[]) => void;
}
declare var hello: HelloJSStatic;
+1 -1
View File
@@ -371,7 +371,7 @@ interface HighchartsLegendOptions {
style?: HighchartsCSSObject;
symbolPadding?: number;
symbolWidth?: number;
useHTML?: number;
useHTML?: boolean;
width?: number;
x?: number;
y?: number;
+2 -1
View File
@@ -7,8 +7,9 @@
/**
* Complets an asynchronous task, allowing Jake's execution to proceed to the next task
* @param value A value to return from the task.
*/
declare function complete(): void;
declare function complete(value?: any): void;
/**
* Creates a description for a Jake Task (or FileTask, DirectoryTask). When invoked, the description that iscreated will be associated with whatever Task is created next.
+242
View File
@@ -0,0 +1,242 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery.pnotify.d.ts" />
function test_pnotify() {
$.pnotify({
title: 'Regular Notice',
text: 'Check me out! I\'m a notice.'
});
$.pnotify({
title: 'Sticky Notice',
text: 'Check me out! I\'m a sticky notice. You\'ll have to close me yourself.',
hide: false
});
$.pnotify({
title: 'See Through Notice',
text: 'No one ever pays attention to me. Why should they? I\'m practically invisible.',
opacity: .8
});
$.pnotify({
title: 'No Shadow Notice',
text: 'I don\'t have a shadow. (It\'s cause I\'m a vampire or something. Or is that reflections...)',
shadow: false
});
$.pnotify('Check me out! I\'m a notice.');
$.pnotify(Math.round(Math.random() * 9999));
$.pnotify({
title: 'PIcon Notice',
text: 'I have an icon that uses the PIcon styles.',
icon: 'picon picon-mail-unread-new'
});
$.pnotify({
title: 'jQuery UI Icon Notice',
text: 'I have an icon that uses the jQuery UI icon styles.',
icon: 'ui-icon ui-icon-mail-closed'
});
$.pnotify({
title: 'Bootstrap Icon Notice',
text: 'I have an icon that uses the Bootstrap icon styles.',
icon: 'glyphicon glyphicon-envelope'
});
$.pnotify({
title: 'No Icon Notice',
text: 'I have no icon.',
icon: false
});
$.pnotify({
title: 'Bootstrap Notice',
text: 'Look at my beautiful styling! ^_^',
styling: 'bootstrap3'
});
$.pnotify({
title: 'Bootstrap Info',
text: 'Look at my beautiful styling! ^_^',
type: 'info',
styling: 'bootstrap3'
});
$.pnotify({
title: 'Bootstrap Success',
text: 'Look at my beautiful styling! ^_^',
type: 'success',
styling: 'bootstrap3'
});
$.pnotify({
title: 'Bootstrap Error',
text: 'Look at my beautiful styling! ^_^',
type: 'error',
styling: 'bootstrap3'
});
$.pnotify({
title: 'jQuery UI Notice',
text: 'Look at my beautiful styling! ^_^',
styling: 'jqueryui'
});
$.pnotify({
title: 'jQuery UI Info',
text: 'Look at my beautiful styling! ^_^',
type: 'info',
styling: 'jqueryui'
});
$.pnotify({
title: 'jQuery UI Success',
text: 'Look at my beautiful styling! ^_^',
type: 'success',
styling: 'jqueryui'
});
$.pnotify({
title: 'jQuery UI Error',
text: 'Look at my beautiful styling! ^_^',
type: 'error',
styling: 'jqueryui'
});
$.pnotify({
title: 'Font Awesome Notice',
text: 'Look at my beautiful styling! ^_^',
styling: 'fontawesome'
});
$.pnotify({
title: 'Font Awesome Info',
text: 'Look at my beautiful styling! ^_^',
type: 'info',
styling: 'fontawesome'
});
$.pnotify({
title: 'Font Awesome Success',
text: 'Look at my beautiful styling! ^_^',
type: 'success',
styling: 'fontawesome'
});
$.pnotify({
title: 'Font Awesome Error',
text: 'Look at my beautiful styling! ^_^',
type: 'error',
styling: 'fontawesome'
});
$.pnotify({
title: 'New Thing',
text: 'Just to let you know, something happened.',
type: 'info'
});
$.pnotify({
title: 'Sticky Info',
text: 'Sticky info, you know, like a newspaper covered in honey.',
type: 'info',
hide: false
});
$.pnotify({
title: 'See Through Info',
text: 'Not only does it not matter, but I don\'t even care if you see this info.',
type: 'info',
opacity: .8
});
$.pnotify({
title: 'No Shadow Success',
text: 'I don\'t have a shadow. (It\'s cause I\'m a vampire or something. Or is that reflections...)',
type: 'success',
shadow: false
});
$.pnotify({
title: 'PIcon Success',
text: 'We reached the moon first! See, we planted a flag.',
type: 'success',
icon: 'picon picon-flag-green'
});
$.pnotify({
title: 'Oh No!',
text: 'Something terrible happened.',
type: 'error'
});
$.pnotify({
title: 'No Icon Error',
text: 'I have no icon.',
type: 'error',
icon: false
});
$.pnotify({
title: 'No Sticky Button Notice',
text: 'Check me out! I\'m a sticky notice with no unsticky button. You\'ll have to close me yourself.',
hide: false,
sticker: false
});
$.pnotify({
title: 'No Mouse Reset Notice',
text: 'I don\'t care if you move your mouse over me, I\'ll disappear when I want.',
mouse_reset: false
});
$.pnotify({
title: '<em>Escaped Notice</em>',
title_escape: true,
text: $('#evil_html').html(),
text_escape: true
});
$.pnotify({
title: 'Non-Blocking Notice',
text: 'I\'m a special kind of notice called "non-blocking". When you hover over me I\'ll fade to show the elements underneath. Feel free to click any of them just like I wasn\'t even here.\n\nNote: HTML links don\'t trigger in some browsers, due to security settings.',
nonblock: true,
nonblock_opacity: .2
});
$.pnotify({
title: 'Custom Styling',
text: 'I have an additional class that\'s used to give me special styling. I always wanted to be pretty.',
addclass: 'custom',
icon: 'picon picon-32 picon-fill-color',
opacity: .8,
nonblock: true,
nonblock_opacity: .2
});
$.pnotify({
title: "PNotify Stacks",
text: "Stacks are used to position notices and determine where new notices will go when they're created. Each notice that's placed into a stack will be positioned related to the other notices in that stack. There is no limit to the number of stacks, and no limit to the number of notices in each stack.",
type: "info",
icon: "fa fa-bars",
delay: 20000,
history: false,
stack: false
});
var type = "error";
var stack_bottomright = {"dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25};
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-bar-top",
cornerclass: "",
width: "100%",
stack: stack_bottomright,
type: "error"
};
$.pnotify(opts);
$.pnotify({
title: 'Show Effect',
text: 'I use a different effect.',
animation: 'show'
});
$.pnotify_remove_all();
}
+173
View File
@@ -0,0 +1,173 @@
// Type definitions for jquery.pnotify 1.3.1
// Project: https://github.com/sciactive/pnotify
// Definitions by: https://github.com/DavidSichau
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface pnotifyStack {
dir1?: string;
dir2?: string;
push?: string;
spacing1?: number;
spacing2?: number;
context?: JQuery
}
interface pnotifyLabel {
redisplay?: string;
all?: string;
last?: string;
close?: string;
stick?: string;
}
interface pnotifyDefaults {
/**
* The notice's title. Either boolean false or string
*/
title?: any;
/**
* Whether to escape the content of the title. (Not allow HTML.)
*/
title_escape?: boolean;
/**
* The notice's text. Either boolean false or string
*/
text?: any;
/**
* Whether to escape the content of the text. (Not allow HTML.)
*/
text_escape?: boolean;
/**
* What styling classes to use. (Can be either jqueryui or bootstrap.)
*/
styling?: string;
/**
* Additional classes to be added to the notice. (For custom styling.)
*/
addclass?: string;
/**
* Class to be added to the notice for corner styling.
*/
cornerclass?: string;
/**
* Create a non-blocking notice. It lets the user click elements underneath it.
*/
nonblock?: boolean;
/**
* The opacity of the notice (if it's non-blocking) when the mouse is over it.
*/
nonblock_opacity?: number;
/**
* Display a pull down menu to redisplay previous notices, and place the notice in the history.
*/
history?: boolean;
/**
* Maximum number of notifications to have onscreen.
*/
maxonscreen?: number;
/**
* Display the notice when it is created. Turn this off to add notifications to the history without displaying them.
*/
auto_display?: boolean;
/**
* Width of the notice.
*/
width?: string;
/**
* Minimum height of the notice. It will expand to fit content.
*/
min_height?: string;
/**
* Type of the notice. "notice", "info", "success", or "error".
*/
type?: string;
/**
* Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class.
*/
icon?: any;
/**
* The animation to use when displaying and hiding the notice. "none", "show", "fade", and "slide" are built in to jQuery. Others require jQuery UI. Use an object with effect_in and effect_out to use different effects.
*/
animation?: any;
/**
* Speed at which the notice animates in and out. "slow", "def" or "normal", "fast" or number of milliseconds.
*/
animate_speed?: string;
/**
* Specify a specific duration of position animation
*/
position_animate_speed?: number;
/**
* Opacity of the notice.
*/
opacity?: number;
/**
* Display a drop shadow.
*/
shadow?: boolean;
/**
* Provide a button for the user to manually close the notice.
*/
closer?: boolean;
/**
* Only show the closer button on hover.
*/
closer_hover?: boolean;
/**
* Provide a button for the user to manually stick the notice.
*/
sticker?: boolean;
/**
* Only show the sticker button on hover.
*/
sticker_hover?: boolean;
/**
* After a delay, remove the notice.
*/
hide?: boolean;
/**
* Delay in milliseconds before the notice is removed.
*/
delay?: number;
/**
* Reset the hide timer if the mouse moves over the notice.
*/
mouse_reset?: boolean;
/**
* Remove the notice's elements from the DOM after it is removed.
*/
remove?: boolean;
/**
* Change new lines to br tags.
*/
insert_brs?: boolean;
/**
* The stack on which the notices will be placed. Also controls the direction the notices stack.
*/
stack?: pnotifyStack;
/**
* The various displayed text, helps facilitating internationalization.
*/
labels?: pnotifyLabel;
}
interface pnotifyInterface {
defaults?: pnotifyDefaults
(options: pnotifyDefaults): any;
}
interface JQueryStatic {
/**
* The pnotify object
*/
pnotify: pnotifyInterface;
/**
* Removes all notifications
*/
pnotify_remove_all(): void;
}
+6 -3
View File
@@ -3164,8 +3164,11 @@ $.ajax({
function test_deferred() {
function returnPromise(): JQueryPromise<(data: { MyString: string; MyNumber: number; }, textStatus: string, jqXHR: JQueryXHR) => any> {
return $.ajax("test.php");
function returnPromise(): JQueryPromise<{ MyString: string; MyNumber: number; }> {
return $.Deferred<{ MyString: string; MyNumber: number; }>().resolve({
MyString: "MyString",
MyNumber: 5
}, "failed", null);
}
var x = returnPromise();
x.done((data, textStatus, jqXHR) => {
@@ -3190,7 +3193,7 @@ function test_deferred() {
function fn3(n) {
$("p").append(n + " 3 " + n);
}
var dfd = $.Deferred();
var dfd = $.Deferred<string>();
dfd
.done([fn1, fn2], fn3, [fn2, fn1])
.done(function (n) {
+34 -10
View File
@@ -287,6 +287,13 @@ interface JQueryGenericPromise<T> {
then<U>(doneFilter: (value: T) => JQueryGenericPromise<U>, failFilter?: (reason: any) => JQueryGenericPromise<U>): JQueryGenericPromise<U>;
}
/**
* Interface for the JQuery promise/deferred callbacks
*/
interface JQueryPromiseCallback<T> {
(value?: T, ...args: any[]): void;
}
/**
* Interface for the JQuery promise, part of callbacks
*/
@@ -297,27 +304,27 @@ interface JQueryPromise<T> {
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
*/
always(alwaysCallbacks1?: T, ...alwaysCallbacks2: T[]): JQueryDeferred<T>;
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is resolved.
*
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
*/
done(doneCallbacks1?: T, ...doneCallbacks2: T[]): JQueryDeferred<T>;
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is rejected.
*
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
*/
fail(failCallbacks1?: T, ...failCallbacks2: T[]): JQueryDeferred<T>;
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object generates progress notifications.
*
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
*/
progress(...progressCallbacks: T[]): JQueryDeferred<T>;
progress(...progressCallbacks: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is either resolved or rejected.
@@ -425,27 +432,36 @@ interface JQueryDeferred<T> extends JQueryPromise<T> {
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
*/
always(alwaysCallbacks1?: T, ...alwaysCallbacks2: T[]): JQueryDeferred<T>;
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
always(alwaysCallbacks1?: JQueryPromiseCallback<T>[], ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: any[]): JQueryDeferred<T>;
always(alwaysCallbacks1?: JQueryPromiseCallback<T>[], ...alwaysCallbacks2: any[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is resolved.
*
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
*/
done(doneCallbacks1?: T, ...doneCallbacks2: T[]): JQueryDeferred<T>;
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
done(doneCallbacks1?: JQueryPromiseCallback<T>[], ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: any[]): JQueryDeferred<T>;
done(doneCallbacks1?: JQueryPromiseCallback<T>[], ...doneCallbacks2: any[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object is rejected.
*
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
*/
fail(failCallbacks1?: T, ...failCallbacks2: T[]): JQueryDeferred<T>;
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
fail(failCallbacks1?: JQueryPromiseCallback<T>[], ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: any[]): JQueryDeferred<T>;
fail(failCallbacks1?: JQueryPromiseCallback<T>[], ...failCallbacks2: any[]): JQueryDeferred<T>;
/**
* Add handlers to be called when the Deferred object generates progress notifications.
*
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
*/
progress(...progressCallbacks: T[]): JQueryDeferred<T>;
progress(...progressCallbacks: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
/**
* Call the progressCallbacks on a Deferred object with the given args.
@@ -2664,6 +2680,14 @@ interface JQuery {
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
*/
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
@@ -2671,7 +2695,7 @@ interface JQuery {
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
@@ -2680,7 +2704,7 @@ interface JQuery {
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
+32 -9
View File
@@ -5,7 +5,9 @@
/// <reference path="../jquery/jquery.d.ts"/>
interface jsPlumb {
declare var jsPlumb: jsPlumbInstance;
interface jsPlumbInstance {
setRenderMode(renderMode: string): string;
bind(event: string, callback: (e) => void ): void;
unbind(event?: string): void;
@@ -17,16 +19,26 @@ interface jsPlumb {
addEndpoint(ep: string): any;
removeClass(el: any, clazz: string): void;
hasClass(el: any, clazz: string): void;
draggable(el: any, container?: DragContainer): void;
connect(connection: ConnectParams): void;
draggable(el: string, options?: DragOptions): jsPlumbInstance;
draggable(ids: string[], options?: DragOptions): jsPlumbInstance;
connect(connection: ConnectParams, referenceParams?: ConnectParams): Connection;
makeSource(el: string, options: SourceOptions): void;
makeTarget(el: string, options: TargetOptions): void;
repaintEverything(): void;
detachEveryConnection(): void;
detachAllConnections(el: string): void;
removeAllEndpoints(el: any): void;
removeAllEndpoints(el: string, recurse?: boolean): jsPlumbInstance;
removeAllEndpoints(el: Element, recurse?: boolean): jsPlumbInstance;
select(params: SelectParams): Connections;
getConnections(options?: any, flat?: any): any[];
getConnections(options?: any, flat?: any): any[];
deleteEndpoint(uuid: string, doNotRepaintAfterwards?: boolean): jsPlumbInstance;
deleteEndpoint(endpoint: Endpoint, doNotRepaintAfterwards?: boolean): jsPlumbInstance;
repaint(el: string): jsPlumbInstance;
repaint(el: Element): jsPlumbInstance;
SVG: string;
CANVAS: string;
VML: string;
}
interface Defaults {
@@ -36,6 +48,8 @@ interface Defaults {
ConnectionsDetachable?: boolean;
ReattachConnections?: boolean;
ConnectionOverlays?: any[][];
Container?: any; // string(selector or id) or element
DragOptions?: DragOptions;
}
interface PaintStyle {
@@ -62,8 +76,8 @@ interface Connections {
}
interface ConnectParams {
source: string;
target: string;
source?: any; // string, element or endpoint
target?: any; // string, element or endpoint
detachable?: boolean;
deleteEndpointsOnDetach?: boolean;
endPoint?: string;
@@ -72,8 +86,8 @@ interface ConnectParams {
label?: string;
}
interface DragContainer {
containment: string;
interface DragOptions {
containment?: string;
}
interface SourceOptions {
@@ -103,3 +117,12 @@ interface SelectParams {
source: string;
target: string;
}
interface Connection {
setDetachable(detachable: boolean): void;
setParameter<T>(name: string, value: T): void;
endpoints: Endpoint[];
}
interface Endpoint {
}
+50
View File
@@ -0,0 +1,50 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jsrender.d.ts"/>
$.views.converters("upper", function(val) {
return val.toUpperCase();
});
$.views.converters({
upper: (val: string) => val.toUpperCase(),
lower: (val: string) => val.toLowerCase()
});
$.views.converters.html("< > ' \" &");
$.views.converters.attr( "< > ' \" &");
$.views.converters.url("<_>_\"_ ");
function renderBoldP(value: any): string {
return "<p><b>" + value + "</b></p>";
}
$.views.tags("boldp", renderBoldP);
$.views.tags("boldp", {
template: "<p><b>{{:~tag.tagCtx.args[0]}}</b></p>"
});
function myFormatFunction(value: string, upper: string): string {
return upper ? value.toUpperCase() : value.toLowerCase();
}
$.views.helpers("format", myFormatFunction);
$.views.helpers({format: myFormatFunction});
var person = {
name: "Adriana"
};
$.templates("personTmpl", "<label>Name:</label> {{:name}}");
var html = $.render["personTmpl"](person);
console.log(html);
var myTmpl = $.templates("<label>Name:</label> {{:name}}");
var html = myTmpl.render(person);
console.log(html);
$.templates({
personTmpl: "#personTemplate",
labelTmpl: "Name:"
});
var html = $("#personTemplate").render(person);
console.log(html);
+56
View File
@@ -0,0 +1,56 @@
// Type definitions for JsRender
// Project: http://www.jsviews.com/#jsrender
// Definitions by: https://github.com/zakki
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare module JsRender {
interface Converters {
(name: string, converterFn: (value: any) => any): any;
(namedConverters: any, parentTemplate?: any): any;
html(valueToEncode: string): string;
attr(valueToEncode: string): string;
url(valueToEncode: string): string;
}
interface Views {
converters: Converters;
tags(name: string, tagFn: (value: any) => any): any;
tags(name: string, tagOptions: any): any;
tags(namedTags: any): any;
helpers(name: string, helper: any): any;
helpers(namedHelpers: any, parentTemplate?: any): any;
}
interface Template {
render(data?: any): string;
}
interface NamedTemplate {
(data?: any): string;
}
interface Render {
(data?: any, helpersOrContext?: any): string;
}
interface RenderStatic {
[index: string]: NamedTemplate;
}
}
interface JQuery {
render: JsRender.Render;
}
interface JQueryStatic {
render: JsRender.RenderStatic;
views: JsRender.Views;
templates(markupOrSelector: string): JsRender.Template;
templates(name: string, markupOrSelector: string): JsRender.Template;
templates(namedTemplates: any): any;
}
+1
View File
@@ -55,6 +55,7 @@ interface JWPlayer {
pause(): void;
play(): void;
playlistItem(index: number): void;
registerPlugin(id: string, target: string, jsPlugin: () => void, swfURL?: string): void;
remove(): void;
removeButton(id: string): void;
resize(width: number, height: number): void;
+2 -1
View File
@@ -48,5 +48,6 @@ interface KnockoutStatic {
}
declare module "knockout.mapping" {
export = KnockoutMapping;
export = mapping;
}
declare var mapping: KnockoutMapping;
+6 -6
View File
@@ -173,14 +173,14 @@ interface KnockoutMemoization {
interface KnockoutVirtualElement {}
interface KnockoutVirtualElements {
allowedBindings: { [bindingName: string]: boolean; };
allowedBindings: { [bindingName: string]: boolean; };
emptyNode(node: KnockoutVirtualElement ): void;
firstChild(node: KnockoutVirtualElement ): KnockoutVirtualElement;
insertAfter( container: KnockoutVirtualElement, nodeToInsert: HTMLElement, insertAfter: HTMLElement ): void;
nextSibling(node: KnockoutVirtualElement): HTMLElement;
prepend(node: KnockoutVirtualElement, toInsert: HTMLElement ): void;
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: HTMLElement; } ): void;
childNodes(node: KnockoutVirtualElement ): HTMLElement[];
insertAfter( container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node ): void;
nextSibling(node: KnockoutVirtualElement): Node;
prepend(node: KnockoutVirtualElement, toInsert: Node ): void;
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; } ): void;
childNodes(node: KnockoutVirtualElement ): Node[];
}
interface KnockoutExtenders {
+24
View File
@@ -5280,6 +5280,30 @@ declare module _ {
keys(object: any): string[];
}
//_.mapValues
interface LoDashStatic {
/**
* Creates an object with the same keys as object and values generated by running each own
* enumerable property of object through the callback. The callback is bound to thisArg and
* invoked with three arguments; (value, key, object).
*
* If a property name is provided for callback the created "_.pluck" style callback will return
* the property value of the given element.
*
* If an object is provided for callback the created "_.where" style callback will return true
* for elements that have the properties of the given object, else false.
*
* @param object The object to iterate over.
* @param callback The function called per iteration.
* @param thisArg `this` object in `iterator`, optional.
* @return Returns a new object with values of the results of each callback execution.
*/
mapValues<T, TResult>(obj: Dictionary<T>, callback: ObjectIterator<T, TResult>, thisArg?: any): Dictionary<TResult>;
mapValues<T>(obj: Dictionary<T>, where: Dictionary<T>): Dictionary<boolean>;
mapValues<T, TMapped>(obj: T, pluck: string): TMapped;
mapValues<T>(obj: T, callback: ObjectIterator<any, any>, thisArg?: any): T;
}
//_.merge
interface LoDashStatic {
/**
+1
View File
@@ -223,6 +223,7 @@ declare module Marionette {
constructor(options?: any);
itemView: any;
children: any;
//_initialEvents();
addChildView(item: View, collection: View, options?: any);
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="./mixto.d.ts" />
import Mixin = require("mixto");
interface ISampleStatic extends Mixto.IMixinStatic {
new ():ISample;
}
interface ISample {
test():string;
}
declare var Sample: ISampleStatic;
Sample.includeInto(Function);
Sample.extend({});
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for mixto
// Project: https://github.com/atom/mixto
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Mixto {
interface IMixinStatic {
includeInto(constructor:any):void;
extend(object:any):void;
}
}
declare module "mixto" {
var _tmp:Mixto.IMixinStatic;
export = _tmp;
}
+9 -3
View File
@@ -3,7 +3,10 @@
// Definitions by: Paul Vick <https://github.com/panopticoncentral>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "nomnom"
// NOTE: Extra identifier's been published is a work-around for the TypeScript 1.0.0.
// original is here -> https://github.com/borisyankov/DefinitelyTyped/commit/9aef1ad84dc006e3d25f5e57709198e33996ba84#diff-0d78c90325d4bfb40327dcc36dcd939a
declare module NomnomInternal
{
/**
* The command-line parser.
@@ -137,7 +140,7 @@ declare module "nomnom"
/**
* The command-line parser.
*/
interface Parser
export interface Parser
{
/**
* Returns the parser.
@@ -220,6 +223,9 @@ declare module "nomnom"
*/
parse(argv?: string[]): any;
}
}
export = Parser;
declare var _nomnom: NomnomInternal.Parser;
declare module "nomnom" {
export = _nomnom;
}
+34
View File
@@ -0,0 +1,34 @@
/// <reference path="notify.js.d.ts" />
function test_Notify_constructor() {
//Min
var n = new Notify("hoge")
n.show();
//With option
n = new Notify("hoge", {body : "fuga"});
n.show();
//With Full option
n = new Notify("hoge", {
body : "fuga",
icon : "./logo.png",
tag : "user",
notifyShow : (e:Event)=> console.log("notifyShow", e),
notifyClose : ()=> console.log("notifyClose"),
notifyClick : ()=> console.log("notifyClick"),
notifyError : ()=> console.log("notifyError"),
permissionGranted : ()=> console.log("permissionGranted"),
permissionDenied : ()=> console.log("permissionDenied")
});
n.show();
}
function test_Notify_static_methods() {
Notify.needsPermission();
Notify.requestPermission();
Notify.requestPermission(()=> console.log("onPermissionGrantedCallback"));
Notify.requestPermission(()=> console.log("onPermissionGrantedCallback"), ()=> console.log("onPermissionDeniedCallback"));
Notify.isSupported();
}
+101
View File
@@ -0,0 +1,101 @@
// Type definitions for notify.js 1.2.0
// Project: https://github.com/alexgibson/notify.js
// Definitions by: soundTricker <https://github.com/soundTricker>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var Notify: {
new (title : string , options? : notify.INotifyOption): notify.INotify;
/**
* Check is permission is needed for the user to receive notifications.
* @return true : needs permission, false : does not need
*/
needsPermission() : boolean;
/**
* Asks the user for permission to display notifications
* @param onPermissionGrantedCallback A callback for permmision is granted.
* @param onPermissionDeniedCallback A callback for permmision is denied.
*/
requestPermission(onPermissionGrantedCallback?: ()=> any, onPermissionDeniedCallback? : ()=> any) : void;
/**
* return true if the browser supports HTML5 Notification
* @param true : the browser supports HTML5 Notification, false ; the browswer does not supports HTML5 Notification.
*/
isSupported() : boolean;
}
declare module notify {
/**
* Interface for Web Notifications API Wrapper.
*/
interface INotify {
/**
* Show the notification.
*/
show() : void;
/**
* Remove all event listener.
*/
destroy() : void;
/**
* Close the notification.
*/
close() : void;
onShowNotification(e : Event) : void;
onCloseNotification() : void;
onClickNotification() : void;
onErrorNotification() : void;
handleEvent(e : Event) : void;
}
/**
* Interface for the Notify's optional parameter.
*/
interface INotifyOption {
/**
* notification message body
*/
body? : string;
/**
* path for icon to display in notification
*/
icon? : string;
/**
* unique identifier to stop duplicate notifications
*/
tag? : string;
/**
* callback when notification is shown
*/
notifyShow? (e : Event): any;
/**
* callback when notification is closed
*/
notifyClose? : Function;
/**
* callback when notification is clicked
*/
notifyClick? : Function;
/**
* callback when notification throws an error
*/
notifyError? : Function;
/**
* callback when user has granted permission
*/
permissionGranted? : Function;
/**
* callback when user has denied permission
*/
permissionDenied? : Function;
}
}
+7 -5
View File
@@ -20,11 +20,13 @@
"node": ">= 0.10.0"
},
"scripts": {
"test": "node ./_infrastructure/tests/runner.js --tsc-version 0.9.7 --test-changes",
"all": "node ./_infrastructure/tests/runner.js --tsc-version 0.9.7",
"dry": "node ./_infrastructure/tests/runner.js --tsc-version 0.9.7 --skip-tests --test-changes",
"list": "node ./_infrastructure/tests/runner.js --tsc-version 0.9.7 --skip-tests --print-files --print-refmap",
"help": "node ./_infrastructure/tests/runner.js -h"
"test": "npm run changes",
"changes": "node ./_infrastructure/tests/runner.js --tsc-version 1.0.0 --test-changes",
"all": "node ./_infrastructure/tests/runner.js --tsc-version 1.0.0",
"dry": "node ./_infrastructure/tests/runner.js --tsc-version 1.0.0 --skip-tests --test-changes",
"list": "node ./_infrastructure/tests/runner.js --tsc-version 1.0.0 --skip-tests --print-files --print-refmap",
"help": "node ./_infrastructure/tests/runner.js -h",
"tsc_runner": "node ./_infrastructure/tests/typescript/1.0.0/tsc ./_infrastructure/tests/runner.ts --target ES5 --out ./_infrastructure/tests/runner.js --module commonjs --sourcemap"
},
"dependencies": {
"source-map-support": "~0.2.5",
+116
View File
@@ -0,0 +1,116 @@
/// <reference path="parsimmon.d.ts" />
import P = require('parsimmon');
import Parser = P.Parser;
import Mark = P.Mark;
// -- -- -- -- -- -- -- -- -- -- -- -- --
class Foo {
bar: Bar;
}
class Bar {
foo: Foo;
}
// -- -- -- -- -- -- -- -- -- -- -- -- --
var str: string;
var num: number;
var regex: RegExp;
var foo: Foo;
var bar: Bar;
var strArr: string[];
var fooArr: Foo[];
var barArr: Bar[];
// -- -- -- -- -- -- -- -- -- -- -- -- --
var strPar: Parser<string>;
var numPar: Parser<number>;
var voidPar: Parser<void>;
var anyPar: Parser<any>;
var fooPar: Parser<Foo>;
var barPar: Parser<Bar>;
// -- -- -- -- -- -- -- -- -- -- -- -- --
var anyArrPar: Parser<any[]>;
var fooArrPar: Parser<Foo[]>;
var barArrPar: Parser<Bar[]>;
// -- -- -- -- -- -- -- -- -- -- -- -- --
var fooMarkPar: Parser<Mark<Foo>>;
// -- -- -- -- -- -- -- -- -- -- -- -- --
foo = fooPar.parse(str);
fooPar = fooPar.or(fooPar);
anyPar = fooPar.or(barPar);
barPar = fooPar.then((f) => {
foo = f;
return barPar;
});
barPar = fooPar.then(barPar);
barPar = fooPar.map((f) => {
foo = f;
return bar;
});
// -- -- -- -- -- -- -- -- -- -- -- -- --
fooPar = fooPar.skip(barPar);
barPar = barPar = fooPar.result(bar);
// -- -- -- -- -- -- -- -- -- -- -- -- --
fooArrPar = fooPar.many();
fooArrPar = fooPar.times(num);
fooArrPar = fooPar.times(num, num);
fooArrPar = fooPar.atMost(num);
fooArrPar = fooPar.atLeast(num);
fooMarkPar = fooPar.mark();
// -- -- -- -- -- -- -- -- -- -- -- -- --
strPar = P.string(str);
strPar = P.regex(regex);
fooPar = P.succeed(foo);
fooArrPar = P.seq(fooPar, fooPar);
anyArrPar = P.seq(barPar, fooPar, numPar);
fooPar = P.lazy(() => {
return fooPar;
});
voidPar = P.fail(str);
fooPar = P.fail<Foo>(str);
// -- -- -- -- -- -- -- -- -- -- -- -- --
strPar = P.letter;
strPar = P.letters;
strPar = P.digit;
strPar = P.digits;
strPar = P.whitespace;
strPar = P.optWhitespace;
strPar = P.any;
strPar = P.all;
strPar = P.eof;
numPar = P.index;
+146
View File
@@ -0,0 +1,146 @@
// Type definitions for Parsimmon 0.3.0
// Project: https://github.com/jayferd/parsimmon
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// TODO convert to generics
declare module 'parsimmon' {
module Parsimmon {
export interface Mark<T> {
start: number;
end: number;
value: T;
}
export interface Parser<T> {
/*
parse the string
*/
parse(input: string): T;
/*
returns a new parser which tries parser, and if it fails uses otherParser.
*/
or(otherParser: Parser<T>): Parser<T>;
or<U>(otherParser: Parser<U>): Parser<any>;
/*
returns a new parser which tries parser, and on success calls the given function with the result of the parse, which is expected to return another parser.
*/
then<U>(call: (result: T) => Parser<U>): Parser<U>;
/*
expects anotherParser to follow parser, and yields the result of anotherParser. NB: the result of parser here is ignored.
*/
then<U>(anotherParser: Parser<U>): Parser<U>;
/*
transforms the output of parser with the given function.
*/
map<U>(call: (result: T) => U): Parser<U>;
/*
expects otherParser after parser, but preserves the yield value of parser.
*/
skip<U>(otherParser: Parser<U>): Parser<T>;
/*
returns a new parser with the same behavior, but which yields aResult.
*/
result<U>(aResult: U): Parser<U>;
/*
expects parser zero or more times, and yields an array of the results.
*/
many(): Parser<T[]>;
/*
expects parser exactly n times, and yields an array of the results.
*/
times(n: number): Parser<T[]>;
/*
expects parser between min and max times, and yields an array of the results.
*/
times(min: number, max: number): Parser<T[]>;
/*
expects parser at most n times. Yields an array of the results.
*/
atMost(n: number): Parser<T[]>;
/*
expects parser at least n times. Yields an array of the results.
*/
atLeast(n: number): Parser<T[]>;
/*
yields an object with start, value, and end keys, where value is the original value yielded by the parser, and start and end are the indices in the stream that contain the parsed text.
*/
mark(): Parser<Mark<T>>;
}
/*
is a parser that expects to find "my-string", and will yield the same.
*/
export function string(mystring: string): Parser<string>;
/*
is a parser that expects the stream to match the given regex.
*/
export function regex(myregex: RegExp): Parser<string>;
/*
is a parser that doesn't consume any of the string, and yields result.
*/
export function succeed<U>(result: U): Parser<U>;
/*
accepts a variable number of parsers that it expects to find in order, yielding an array of the results.
*/
export function seq(...parsers: Parser<any>[]): Parser<any[]>;
/*
accepts a function that returns a parser, which is evaluated the first time the parser is used. This is useful for referencing parsers that haven't yet been defined.
*/
export function lazy<U>(f: () => Parser<U>): Parser<U>;
/*
fail paring with a message
*/
export function fail(message: string): Parser<void>;
export function fail<U>(message: string): Parser<U>;
/*
is equivalent to Parsimmon.regex(/[a-z]/i)
*/
export var letter: Parser<string>;
/*
is equivalent to Parsimmon.regex(/[a-z]*`/i)
*/
export var letters: Parser<string>;
/*
is equivalent to Parsimmon.regex(/[0-9]/)
*/
export var digit: Parser<string>;
/*
is equivalent to Parsimmon.regex(/[0-9]*`/)
*/
export var digits: Parser<string>;
/*
is equivalent to Parsimmon.regex(/\s+/)
*/
export var whitespace: Parser<string>;
/*
is equivalent to Parsimmon.regex(/\s*`/)
*/
export var optWhitespace: Parser<string>;
/*
consumes and yields the next character of the stream.
*/
export var any: Parser<string>;
/*
consumes and yields the entire remainder of the stream.
*/
export var all: Parser<string>;
/*
expects the end of the stream.
*/
export var eof: Parser<string>;
/*
is a parser that yields the current index of the parse.
*/
export var index: Parser<number>;
}
export = Parsimmon;
}
+61
View File
@@ -0,0 +1,61 @@
/// <reference path="passport.d.ts" />
/// <reference path="../express/express.d.ts" />
import express = require('express');
import passport = require('passport');
class TestStrategy implements passport.Strategy {
public name: string = 'test';
constructor() {}
authenticate(req: express.Request) {}
}
passport.use(new TestStrategy());
passport.framework('test');
passport.serializeUser((user, done) => {});
passport.deserializeUser((id, done) => {});
passport.use(new TestStrategy())
.unuse('test')
.use(new TestStrategy())
.framework('test-fw');
var app = express();
app.configure(() => {
app.use(passport.initialize());
app.use(passport.session());
});
app.post('/login',
passport.authenticate('local', { failureRedirect: '/login', failureFlash: true }),
function(req, res) {
res.redirect('/');
});
app.post('/login', function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (err) { return next(err) }
if (!user) {
req.session.error = info.message;
return res.redirect('/login')
}
req.logIn(user, function(err) {
if (err) { return next(err); }
return res.redirect('/users/' + user.username);
});
})(req, res, next);
});
app.get('/logout', function(req, res) {
req.logout();
res.redirect('/');
});
function ensureAuthenticated(req: express.Request, res: express.Response, next: (err?: any) => void) {
if (req.isAuthenticated()) { return next(); }
if (req.isUnauthenticated()) {
res.redirect('/login');
}
}
+62
View File
@@ -0,0 +1,62 @@
// Type definitions for Passport v0.2.0
// Project: http://passportjs.org
// Definitions by: Horiuchi_H <https://github.com/horiuchi/>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module 'passport' {
import express = require('express');
function use(strategy: Strategy): Passport;
function use(name: string, strategy: Strategy): Passport;
function unuse(name: string): Passport;
function framework(fw: string): Passport;
function initialize(options?: { userProperty: string; }): express.Handler;
function session(options?: { pauseStream: boolean; }): express.Handler;
function authenticate(strategy: string, options: Object, callback?: express.Handler): express.Handler;
function authenticate(strategy: string, callback2: (err: any, user: any, info: any) => void): express.Handler;
function authorize(strategy: string, options: Object, callback?: express.Handler): express.Handler;
function serializeUser(fn: (user: any, done: (err: any, id: any) => void) => void): void;
function deserializeUser(fn: (id: any, done: (err: any, user: any) => void) => void): void;
function transformAuthInfo(fn: (info: any, done: (err: any, info: any) => void) => void): void;
interface Passport {
use(strategy: Strategy): Passport;
use(name: string, strategy: Strategy): Passport;
unuse(name: string): Passport;
framework(fw: string): Passport;
initialize(options?: { userProperty: string; }): express.Handler;
session(options?: { pauseStream: boolean; }): express.Handler;
authenticate(strategy: string, callback2: (err: any, user: any, info: any) => void): express.Handler;
authenticate(strategy: string, options: Object, callback?: express.Handler): express.Handler;
authorize(strategy: string, options: Object, callback?: express.Handler): express.Handler;
serializeUser(fn: (user: any, done: (err: any, id: any) => void) => void): void;
deserializeUser(fn: (id: any, done: (err: any, user: any) => void) => void): void;
transformAuthInfo(fn: (info: any, done: (err: any, info: any) => void) => void): void;
}
interface Strategy {
name?: string;
authenticate(req: express.Request, options?: Object): void;
}
}
declare module Express {
export interface Request {
// These declarations are merged into express's Request type
login(user: any, done: (err: any) => void): void;
login(user: any, options: Object, done: (err: any) => void): void;
logIn(user: any, done: (err: any) => void): void;
logIn(user: any, options: Object, done: (err: any) => void): void;
logout(): void;
logOut(): void;
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
}
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="./pathwatcher.d.ts" />
import pathwatcher = require("pathwatcher");
var File = pathwatcher.File;
var filePath: string;
var file = new File(filePath);
pathwatcher.watch(filePath, ()=>{
});
+87
View File
@@ -0,0 +1,87 @@
// Type definitions for pathwatcher
// Project: https://github.com/atom/node-pathwatcher
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../q/Q.d.ts" />
declare module "pathwatcher" {
import events = require("events");
interface IHandleWatcher extends events.EventEmitter {
onEvent(event:any, filePath:any, oldFilePath:any):any;
start():void;
closeIfNoListener():void;
close():void;
}
interface IPathWatcher {
isWatchingParent:boolean;
path:any;
handleWatcher:IHandleWatcher;
close():void;
}
interface IFileStatic {
new (path:string, symlink?:boolean):IFile;
}
interface IFile {
realPath:string;
path:string;
symlink:boolean;
cachedContents:string;
digest:string;
handleEventSubscriptions():void;
setPath(path:string):void;
getPath():string;
getRealPathSync():string;
getBaseName():string;
write(text:string):void;
readSync(flushCache:boolean):string;
read(flushCache?:boolean):Q.Promise<string>;
exists():boolean;
setDigest(contents:string):void;
getDigest():string;
writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void;
handleNativeChangeEvent(eventType:string, eventPath:string):void;
detectResurrectionAfterDelay():void;
detectResurrection():void;
subscribeToNativeChangeEvents():void;
unsubscribeFromNativeChangeEvents():void;
}
interface IDirectoryStatic {
new (path:string, symlink?:boolean):IDirectory;
}
interface IDirectory {
realPath:string;
path:string;
symlink:boolean;
getBaseName():string;
getPath():void;
getRealPathSync():string;
contains(pathToCheck:string):boolean;
relativize(fullPath:string):string;
getEntriesSync():any[]; // return type are {File | Directory}[]
getEntries(callback:Function):void;
subscribeToNativeChangeEvents():void;
unsubscribeFromNativeChangeEvents():void;
isPathPrefixOf(prefix:string, fullPath:string):boolean;
}
function watch(path:string, callback:Function):IPathWatcher;
function closeAllWatchers():void;
function getWatchedPaths():string[];
var File:IFileStatic;
var Directory:IDirectoryStatic;
}
+5
View File
@@ -0,0 +1,5 @@
/// <reference path="./pegjs.d.ts" />
var input: string;
var result = PEG.parse(input);
console.log(result);
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for PEG.js
// Project: http://pegjs.majda.cz/
// Definitions by: vvakame <https://github.com/vvakame>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module PEG {
function parse(input:string):any;
class SyntaxError {
line:number;
column:number;
offset:number;
expected:any[];
found:any;
name:string;
message:string;
}
}
+1 -1
View File
@@ -12,7 +12,7 @@
// Library documentation : http://www.createjs.com/Docs/PreloadJS/modules/PreloadJS.html
/// <reference path="../createjs/createjs.d.ts" />
/// <reference path="../createjs-lib/createjs-lib.d.ts" />
declare module createjs {
export class AbstractLoader extends EventDispatcher {
+1 -1
View File
@@ -200,7 +200,7 @@ interface RaphaelPaper {
clear(): void;
defs: SVGDefsElement;
ellipse(x: number, y: number, rx: number, ry: number): RaphaelElement;
forEach(callback: number, thisArg: any): RaphaelStatic;
forEach(callback: (el: RaphaelElement) => boolean, thisArg?: any): RaphaelPaper;
getById(id: number): RaphaelElement;
getElementByPoint(x: number, y: number): RaphaelElement;
getElementsByPoint(x: number, y: number): RaphaelSet;
+8
View File
@@ -322,6 +322,14 @@ interface RequireDefine {
* callback return module definition
**/
(name: string, deps: string[], ready: Function): void;
/**
* Define a module with a name.
* @param name The name of the module.
* @param ready Callback function when the dependencies are loaded.
* callback return module definition
**/
(name: string, ready: Function): void;
}
// Ambient declarations for 'require' and 'define'
+74 -2
View File
@@ -201,13 +201,27 @@ declare module Rx {
catch(handler: (exception: any) => Observable<T>): Observable<T>;
catchException(handler: (exception: any) => Observable<T>): Observable<T>; // alias for catch
catch(handler: (exception: any) => IPromise<T>): Observable<T>;
catchException(handler: (exception: any) => IPromise<T>): Observable<T>; // alias for catch
catch(second: Observable<T>): Observable<T>;
catchException(second: Observable<T>): Observable<T>; // alias for catch
combineLatest<T2, TResult>(second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
combineLatest<T2, TResult>(second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
combineLatest<T2, T3, TResult>(second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T2, T3, TResult>(second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T2, T3, TResult>(second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T2, T3, TResult>(second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, TResult>(second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T2, T3, T4, T5, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, fifth: Observable<T5>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable<TResult>;
combineLatest<TOther, TResult>(souces: Observable<TOther>[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable<TResult>;
combineLatest<TOther, TResult>(souces: IPromise<TOther>[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable<TResult>;
concat(...sources: Observable<T>[]): Observable<T>;
concat(...sources: IPromise<T>[]): Observable<T>;
concat(sources: Observable<T>[]): Observable<T>;
@@ -224,10 +238,22 @@ declare module Rx {
switchLatest(): T; // alias for switch
takeUntil<T2>(other: Observable<T2>): Observable<T>;
zip<T2, TResult>(second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
zip<T2, TResult>(second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
zip<T2, T3, TResult>(second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
zip<T2, T3, TResult>(second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
zip<T2, T3, TResult>(second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
zip<T2, T3, TResult>(second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, TResult>(second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
zip<T2, T3, T4, T5, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, fifth: Observable<T5>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable<TResult>;
zip<TOther, TResult>(second: Observable<TOther>[], resultSelector: (left: T, right: Observable<TOther>) => TResult): Observable<TResult>;
zip<TOther, TResult>(second: Observable<TOther>[], resultSelector: (left: T, ...right: TOther[]) => TResult): Observable<TResult>;
zip<TOther, TResult>(second: IPromise<TOther>[], resultSelector: (left: T, ...right: TOther[]) => TResult): Observable<TResult>;
asObservable(): Observable<T>;
dematerialize<TOrigin>(): Observable<TOrigin>;
@@ -368,6 +394,39 @@ declare module Rx {
catch<T>(...sources: IPromise<T>[]): Observable<T>;
catchException<T>(...sources: Observable<T>[]): Observable<T>; // alias for catch
catchException<T>(...sources: IPromise<T>[]): Observable<T>; // alias for catch
combineLatest<T, T2, TResult>(first: Observable<T>, second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
combineLatest<T, T2, TResult>(first: IPromise<T>, second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
combineLatest<T, T2, TResult>(first: Observable<T>, second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
combineLatest<T, T2, TResult>(first: IPromise<T>, second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: Observable<T>, second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: Observable<T>, second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: Observable<T>, second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: IPromise<T>, second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: IPromise<T>, second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: IPromise<T>, second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, TResult>(first: IPromise<T>, second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
combineLatest<T, T2, T3, T4, T5, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, fifth: Observable<T5>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable<TResult>;
combineLatest<TOther, TResult>(souces: Observable<TOther>[], resultSelector: (...otherValues: TOther[]) => TResult): Observable<TResult>;
combineLatest<TOther, TResult>(souces: IPromise<TOther>[], resultSelector: (...otherValues: TOther[]) => TResult): Observable<TResult>;
concat<T>(...sources: Observable<T>[]): Observable<T>;
concat<T>(...sources: IPromise<T>[]): Observable<T>;
concat<T>(sources: Observable<T>[]): Observable<T>;
@@ -380,10 +439,23 @@ declare module Rx {
merge<T>(scheduler: IScheduler, ...sources: IPromise<T>[]): Observable<T>;
merge<T>(scheduler: IScheduler, sources: Observable<T>[]): Observable<T>;
merge<T>(scheduler: IScheduler, sources: IPromise<T>[]): Observable<T>;
zip<T1, T2, TResult>(first: Observable<T1>, sources: Observable<T2>[], resultSelector: (item1: T1, right: Observable<T2>) => TResult): Observable<TResult>;
zip<T1, T2, TResult>(first: Observable<T1>, sources: Observable<T2>[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable<TResult>;
zip<T1, T2, TResult>(first: Observable<T1>, sources: IPromise<T2>[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable<TResult>;
zip<T1, T2, TResult>(source1: Observable<T1>, source2: Observable<T2>, resultSelector: (item1: T1, item2: T2) => TResult): Observable<TResult>;
zip<T1, T2, TResult>(source1: Observable<T1>, source2: IPromise<T2>, resultSelector: (item1: T1, item2: T2) => TResult): Observable<TResult>;
zip<T1, T2, T3, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: Observable<T3>, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable<TResult>;
zip<T1, T2, T3, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: IPromise<T3>, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable<TResult>;
zip<T1, T2, T3, TResult>(source1: Observable<T1>, source2: IPromise<T2>, source3: Observable<T3>, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable<TResult>;
zip<T1, T2, T3, TResult>(source1: Observable<T1>, source2: IPromise<T2>, source3: IPromise<T3>, resultSelector: (item1: T1, item2: T2, item3: T3) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: Observable<T3>, source4: Observable<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: Observable<T3>, source4: IPromise<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: IPromise<T3>, source4: Observable<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: IPromise<T3>, source4: IPromise<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: IPromise<T2>, source3: Observable<T3>, source4: Observable<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: IPromise<T2>, source3: Observable<T3>, source4: IPromise<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: IPromise<T2>, source3: IPromise<T3>, source4: Observable<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, TResult>(source1: Observable<T1>, source2: IPromise<T2>, source3: IPromise<T3>, source4: IPromise<T4>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4) => TResult): Observable<TResult>;
zip<T1, T2, T3, T4, T5, TResult>(source1: Observable<T1>, source2: Observable<T2>, source3: Observable<T3>, source4: Observable<T4>, source5: Observable<T5>, resultSelector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5) => TResult): Observable<TResult>;
zipArray<T>(...sources: Observable<T>[]): Observable<T[]>;
zipArray<T>(sources: Observable<T>[]): Observable<T[]>;
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for RxJS-Aggregates package
// Type definitions for RxJS-Aggregates v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
@@ -33,7 +33,9 @@ declare module Rx {
average(keySelector?: (value: T, index: number, source: Observable<T>) => number, thisArg?: any): Observable<number>;
sequenceEqual<TOther>(second: Observable<TOther>, comparer: (value1: T, value2: TOther) => number): Observable<boolean>;
sequenceEqual<TOther>(second: IPromise<TOther>, comparer: (value1: T, value2: TOther) => number): Observable<boolean>;
sequenceEqual(second: Observable<T>): Observable<boolean>;
sequenceEqual(second: IPromise<T>): Observable<boolean>;
sequenceEqual<TOther>(second: TOther[], comparer: (value1: T, value2: TOther) => number): Observable<boolean>;
sequenceEqual(second: T[]): Observable<boolean>;
+2
View File
@@ -1,6 +1,8 @@
// This file contains common part of defintions for rx.async.d.ts and rx.lite.d.ts
// Do not include the file separately.
///<reference path="rx-lite.d.ts"/>
declare module Rx {
interface ObservableStatic {
/**
+2 -2
View File
@@ -1,11 +1,11 @@
// Type definitions for RxJS-Async v2.2.18
// Type definitions for RxJS-Async v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: zoetrope <https://github.com/zoetrope>
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx.d.ts" />
///<reference path="rx.async-lite.ts" />
///<reference path="rx.async-lite.d.ts" />
declare module Rx {
interface ObservableStatic {
@@ -1,6 +1,8 @@
// This file contains common part of defintions for rx.backpressure.d.ts and rx.lite.d.ts
// Do not include the file separately.
///<reference path="rx-lite.d.ts"/>
declare module Rx {
export interface Observable<T> {
/**
@@ -12,6 +14,7 @@ declare module Rx {
* @returns The observable sequence which is paused based upon the pauser.
*/
pausable(pauser: Observable<boolean>): Observable<T>;
pausable(pauser?: ISubject<boolean>): PausableObservable<T>;
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
@@ -22,7 +25,7 @@ declare module Rx {
* @param pauser The observable sequence used to pause the underlying sequence.
* @returns The observable sequence which is paused based upon the pauser.
*/
pausableBuffered(pauser: Observable<boolean>): Observable<T>;
pausableBuffered(pauser?: ISubject<boolean>): PausableObservable<T>;
/**
* Attaches a controller to the observable sequence with the ability to queue.
@@ -36,4 +39,9 @@ declare module Rx {
export interface ControlledObservable<T> extends Observable<T> {
request(numberOfItems?: number): IDisposable;
}
export interface PausableObservable<T> extends Observable<T> {
pause(): void;
resume(): void;
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
// Type definitions for RxJS-BackPressure v2.2.18
// Type definitions for RxJS-BackPressure v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx.d.ts" />
///<reference path="rx.backpressure-lite.ts" />
///<reference path="rx.backpressure-lite.d.ts" />
+1 -1
View File
@@ -1,7 +1,7 @@
// This file contains common part of defintions for rx.binding.d.ts and rx.lite.d.ts
// Do not include the file separately.
///<reference path="rx-lite.ts"/>
///<reference path="rx-lite.d.ts"/>
declare module Rx {
export interface BehaviorSubject<T> extends Subject<T> {
+2 -2
View File
@@ -1,11 +1,11 @@
// Type definitions for RxJS-Binding v2.2.18
// Type definitions for RxJS-Binding v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx.d.ts" />
///<reference path="rx.binding-lite.ts" />
///<reference path="rx.binding-lite.d.ts" />
declare module Rx {
export interface Observable<T> {
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for RxJS-Coincidence package
// Type definitions for RxJS-Coincidence v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
+8 -2
View File
@@ -1,10 +1,10 @@
// Type definitions for RxJS v2.2.18
// Type definitions for RxJS v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx-lite.ts"/>
///<reference path="rx-lite.d.ts"/>
declare module Rx {
export interface IScheduler {
@@ -66,7 +66,9 @@ declare module Rx {
subscribeOn(scheduler: IScheduler): Observable<T>;
amb(rightSource: Observable<T>): Observable<T>;
amb(rightSource: IPromise<T>): Observable<T>;
onErrorResumeNext(second: Observable<T>): Observable<T>;
onErrorResumeNext(second: IPromise<T>): Observable<T>;
bufferWithCount(count: number, skip?: number): Observable<T[]>;
windowWithCount(count: number, skip?: number): Observable<Observable<T>>;
defaultIfEmpty(defaultValue?: T): Observable<T>;
@@ -81,9 +83,13 @@ declare module Rx {
interface ObservableStatic {
using<TSource, TResource extends IDisposable>(resourceFactory: () => TResource, observableFactory: (resource: TResource) => Observable<TSource>): Observable<TSource>;
amb<T>(...sources: Observable<T>[]): Observable<T>;
amb<T>(...sources: IPromise<T>[]): Observable<T>;
amb<T>(sources: Observable<T>[]): Observable<T>;
amb<T>(sources: IPromise<T>[]): Observable<T>;
onErrorResumeNext<T>(...sources: Observable<T>[]): Observable<T>;
onErrorResumeNext<T>(...sources: IPromise<T>[]): Observable<T>;
onErrorResumeNext<T>(sources: Observable<T>[]): Observable<T>;
onErrorResumeNext<T>(sources: IPromise<T>[]): Observable<T>;
}
interface GroupedObservable<TKey, TElement> extends Observable<TElement> {
+45 -16
View File
@@ -1,4 +1,4 @@
// Type definitions for RxJS/Experimental
// Type definitions for RxJS-Experimental v2.2.20
// Project: https://github.com/Reactive-Extensions/RxJS/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -45,11 +45,12 @@ declare module Rx {
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param second Second observable sequence.
* @param second Second observable sequence or promise.
* @param resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
forkJoin<TSecond, TResult>(second: Observable<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): Observable<TResult>;
forkJoin<TSecond, TResult>(second: IPromise<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): Observable<TResult>;
/**
* Comonadic bind operator.
@@ -67,11 +68,14 @@ declare module Rx {
* @example
* res = Rx.Observable.if(condition, obs1, obs2);
* @param condition The condition which determines if the thenSource or elseSource will be run.
* @param thenSource The observable sequence that will be run if the condition function returns true.
* @param elseSource The observable sequence that will be run if the condition function returns false.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param elseSource The observable sequence or promise that will be run if the condition function returns false.
* @returns An observable sequence which is either the thenSource or elseSource.
*/
if<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: Observable<T>): Observable<T>;
if<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: IPromise<T>): Observable<T>;
if<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: Observable<T>): Observable<T>;
if<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: IPromise<T>): Observable<T>;
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
@@ -79,11 +83,12 @@ declare module Rx {
* @example
* res = Rx.Observable.if(condition, obs1, scheduler);
* @param condition The condition which determines if the thenSource or empty sequence will be run.
* @param thenSource The observable sequence that will be run if the condition function returns true.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
* @returns An observable sequence which is either the thenSource or empty sequence.
*/
if<T>(condition: () => boolean, thenSource: Observable<T>, scheduler?: IScheduler): Observable<T>;
if<T>(condition: () => boolean, thenSource: IPromise<T>, scheduler?: IScheduler): Observable<T>;
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
@@ -91,11 +96,14 @@ declare module Rx {
* @example
* res = Rx.Observable.if(condition, obs1, obs2);
* @param condition The condition which determines if the thenSource or elseSource will be run.
* @param thenSource The observable sequence that will be run if the condition function returns true.
* @param elseSource The observable sequence that will be run if the condition function returns false.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param elseSource The observable sequence or promise that will be run if the condition function returns false.
* @returns An observable sequence which is either the thenSource or elseSource.
*/
ifThen<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: Observable<T>): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: Observable<T>, elseSource: IPromise<T>): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: Observable<T>): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: IPromise<T>, elseSource: IPromise<T>): Observable<T>;
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
@@ -103,11 +111,12 @@ declare module Rx {
* @example
* res = Rx.Observable.if(condition, obs1, scheduler);
* @param condition The condition which determines if the thenSource or empty sequence will be run.
* @param thenSource The observable sequence that will be run if the condition function returns true.
* @param thenSource The observable sequence or promise that will be run if the condition function returns true.
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
* @returns An observable sequence which is either the thenSource or empty sequence.
*/
ifThen<T>(condition: () => boolean, thenSource: Observable<T>, scheduler?: IScheduler): Observable<T>;
ifThen<T>(condition: () => boolean, thenSource: IPromise<T>, scheduler?: IScheduler): Observable<T>;
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
@@ -131,19 +140,21 @@ declare module Rx {
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence that will be run if the condition function returns true.
* @param source The observable sequence or promise that will be run if the condition function returns true.
* @returns An observable sequence which is repeated as long as the condition holds.
*/
while<T>(condition: () => boolean, source: Observable<T>): Observable<T>;
while<T>(condition: () => boolean, source: IPromise<T>): Observable<T>;
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
* @param condition The condition which determines if the source will be repeated.
* @param source The observable sequence that will be run if the condition function returns true.
* @param source The observable sequence or promise that will be run if the condition function returns true.
* @returns An observable sequence which is repeated as long as the condition holds.
*/
whileDo<T>(condition: () => boolean, source: Observable<T>): Observable<T>;
whileDo<T>(condition: () => boolean, source: IPromise<T>): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -153,11 +164,14 @@ declare module Rx {
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence that will be run if the sources are not matched.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -174,6 +188,7 @@ declare module Rx {
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -183,11 +198,14 @@ declare module Rx {
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence that will be run if the sources are not matched.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -204,6 +222,7 @@ declare module Rx {
* @returns An observable sequence which is determined by a case statement.
*/
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -213,11 +232,14 @@ declare module Rx {
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence that will be run if the sources are not matched.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -234,6 +256,7 @@ declare module Rx {
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -243,11 +266,14 @@ declare module Rx {
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* @param selector The function which extracts the value for to test in a case statement.
* @param sources A object which has keys which correspond to the case statement labels.
* @param elseSource The observable sequence that will be run if the sources are not matched.
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
*
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: IPromise<T>): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: IPromise<T>): Observable<T>;
/**
* Uses selector to determine which source in sources to use.
@@ -264,25 +290,28 @@ declare module Rx {
* @returns An observable sequence which is determined by a case statement.
*/
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* res = Rx.Observable.forkJoin([obs1, obs2]);
* @param sources Array of source sequences.
* @param sources Array of source sequences or promises.
* @returns An observable sequence with an array collecting the last elements of all the input sequences.
*/
forkJoin<T>(sources: Observable<T>[]): Observable<T[]>;
forkJoin<T>(sources: IPromise<T>[]): Observable<T[]>;
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @param args Source sequences.
* @param args Source sequences or promises.
* @returns An observable sequence with an array collecting the last elements of all the input sequences.
*/
forkJoin<T>(...args: Observable<T>[]): Observable<T[]>;
forkJoin<T>(...args: IPromise<T>[]): Observable<T[]>;
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for RxJS-Join package
// Type definitions for RxJS-Join v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
+6 -6
View File
@@ -1,14 +1,14 @@
// Type definitions for RxJS-Lite v2.2.18
// Type definitions for RxJS-Lite v2.2.20
// Project: http://rx.codeplex.com/
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx-lite.ts"/>
///<reference path="rx.async-lite.ts" />
///<reference path="rx.binding-lite.ts" />
///<reference path="rx.time-lite.ts" />
///<reference path="rx.backpressure-lite.ts" />
///<reference path="rx-lite.d.ts"/>
///<reference path="rx.async-lite.d.ts" />
///<reference path="rx.binding-lite.d.ts" />
///<reference path="rx.time-lite.d.ts" />
///<reference path="rx.backpressure-lite.d.ts" />
declare module Rx {
export class Scheduler implements IScheduler {

Some files were not shown because too many files have changed in this diff Show More