add sat.js type definitions

This commit is contained in:
omni360
2016-02-15 17:36:05 +08:00
parent bcd5761826
commit 05efb3d415
17 changed files with 7027 additions and 6862 deletions

View File

@@ -1,62 +1,62 @@
// Type definitions for angular-google-analytics v1.1.0
// Project: https://github.com/revolunet/angular-google-analytics
// Definitions by: Matt Wheatley <https://github.com/terrawheat>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module angular.google.analytics {
interface AnalyticsService {
/**
* @summary If logging is enabled then all outbound calls are accessible via an in-memory array.
* This is useful for troubleshooting and seeing the order of outbound calls with parameters.
*/
log: Array<Object>;
/**
* @summary If in offline mode then all calls are queued to an in-memory array for future processing.
* All calls queued to the offlineQueue are not outbound calls yet and hence do not show up in the log.
*/
offlineQueue: Array<Object>;
/**
* @summary Returns the current URL that would be sent if a `trackPage` call was made.
* @return {string} The URL
*/
getUrl: () => string;
/**
* @summary Manually create classic analytics (ga.js) script tag
*/
createScriptTag: () => void;
/**
* @summary Manually create universal analytics (analytics.js) script tag
*/
createAnalyticsScriptTag: () => void;
/**
* @summary Allows for advanced configuration and definitions in univeral analytics only. This is a no-op when using classic analytics.
*/
set: (key: string, value: any, accountName?: string) => void;
/**
* @summary Creates a new page view event
* @param {string} pageURL URL of page view
* @param {string} title Page Title
* @param {Object} dimensions Additional dimensions and metrics
*/
trackPage: (pageURL: string, title?: string, dimensions?: { [expr: string]: any }) => void;
/**
* @summary Create a new event
*/
trackEvent: (category: string, action: string, label: string, value?: any, nonInteractionFlag?: boolean, dimensions?: { [expr: string]: any }) => void;
trackException: (descrption: string, isFatal: boolean) => void;
/**
* @summary While in offline mode, no calls to the ga function or pushes to the gaq array are made.
* This will queue all calls for later sending once offline mode is reset to false.
*/
offline: (offlineMode: boolean) => void;
}
}
// Type definitions for angular-google-analytics v1.1.0
// Project: https://github.com/revolunet/angular-google-analytics
// Definitions by: Matt Wheatley <https://github.com/terrawheat>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module angular.google.analytics {
interface AnalyticsService {
/**
* @summary If logging is enabled then all outbound calls are accessible via an in-memory array.
* This is useful for troubleshooting and seeing the order of outbound calls with parameters.
*/
log: Array<Object>;
/**
* @summary If in offline mode then all calls are queued to an in-memory array for future processing.
* All calls queued to the offlineQueue are not outbound calls yet and hence do not show up in the log.
*/
offlineQueue: Array<Object>;
/**
* @summary Returns the current URL that would be sent if a `trackPage` call was made.
* @return {string} The URL
*/
getUrl: () => string;
/**
* @summary Manually create classic analytics (ga.js) script tag
*/
createScriptTag: () => void;
/**
* @summary Manually create universal analytics (analytics.js) script tag
*/
createAnalyticsScriptTag: () => void;
/**
* @summary Allows for advanced configuration and definitions in univeral analytics only. This is a no-op when using classic analytics.
*/
set: (key: string, value: any, accountName?: string) => void;
/**
* @summary Creates a new page view event
* @param {string} pageURL URL of page view
* @param {string} title Page Title
* @param {Object} dimensions Additional dimensions and metrics
*/
trackPage: (pageURL: string, title?: string, dimensions?: { [expr: string]: any }) => void;
/**
* @summary Create a new event
*/
trackEvent: (category: string, action: string, label: string, value?: any, nonInteractionFlag?: boolean, dimensions?: { [expr: string]: any }) => void;
trackException: (descrption: string, isFatal: boolean) => void;
/**
* @summary While in offline mode, no calls to the ga function or pushes to the gaq array are made.
* This will queue all calls for later sending once offline mode is reset to false.
*/
offline: (offlineMode: boolean) => void;
}
}

View File

@@ -1,314 +1,314 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path='../lodash/lodash-3.10.d.ts' />
/// <reference path="./backbone-global.d.ts" />
function test_events() {
var object = new Backbone.Events();
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
object.trigger("alert", "an event");
var onChange = () => alert('whatever');
var context: any;
object.off("change", onChange);
object.off("change");
object.off(null, onChange);
object.off(null, null, context);
object.off();
}
class SettingDefaults extends Backbone.Model {
// 'defaults' could be set in one of the following ways:
defaults() {
return {
name: "Joe"
}
}
constructor(attributes?: any, options?: any) {
this.defaults = <any>{
name: "Joe"
}
// super has to come last
super(attributes, options);
}
// or set it like this
initialize() {
this.defaults = <any>{
name: "Joe"
}
}
// same patterns could be used for setting 'Router.routes' and 'View.events'
}
class Sidebar extends Backbone.Model {
promptColor() {
var cssColor = prompt("Please enter a CSS color:");
this.set({ color: cssColor });
}
}
class Note extends Backbone.Model {
initialize() { }
author() { }
coordinates() { }
allowedToEdit(account: any) {
return true;
}
}
class PrivateNote extends Note {
allowedToEdit(account: any) {
return account.owns(this);
}
set(attributes: any, options?: any): Backbone.Model {
return Backbone.Model.prototype.set.call(this, attributes, options);
}
}
function test_models() {
var sidebar = new Sidebar();
sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color }));
sidebar.set({ color: 'white' });
sidebar.promptColor();
//////////
var note = new PrivateNote();
note.get("title");
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
note.set("title", "A Scandal in Bohemia");
}
class Employee extends Backbone.Model {
reports: EmployeeCollection;
constructor(attributes?: any, options?: any) {
super(options);
this.reports = new EmployeeCollection();
this.reports.url = '../api/employees/' + this.id + '/reports';
}
more() {
this.reports.reset();
}
}
class EmployeeCollection extends Backbone.Collection<Employee> {
findByName(key: any) { }
}
class Book extends Backbone.Model {
title: string;
author: string;
published: boolean;
}
class Library extends Backbone.Collection<Book> {
// This model definition is here only to test type compatibility of the model, but it
// is not necessary in working code as it is automatically inferred through generics.
model: typeof Book;
}
class Books extends Backbone.Collection<Book> { }
function test_collection() {
var books = new Books();
var book1: Book = new Book({ title: "Title 1", author: "Mike" });
books.add(book1);
// Objects can be added to collection by casting to model type.
// Compiler will check if object properties are valid for the cast.
// This gives better type checking than declaring an `any` overload.
books.add(<Book>{ title: "Title 2", author: "Mikey" });
var model: Book = book1.collection.first();
if (model !== book1) {
throw new Error("Error");
}
books.each(book =>
book.get("title"));
var titles = books.map(book =>
book.get("title"));
var publishedBooks = books.filter(book =>
book.get("published") === true);
var alphabetical = books.sortBy((book: Book): number => null);
}
//////////
Backbone.history.start();
module v1Changes {
module events {
function test_once() {
var model = new Employee;
model.once('invalid', () => { }, this);
model.once('invalid', () => { });
}
function test_listenTo() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.listenTo(model, 'invalid', () => { });
}
function test_listenToOnce() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.listenToOnce(model, 'invalid', () => { });
}
function test_stopListening() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.stopListening(model, 'invalid', () => { });
view.stopListening(model, 'invalid');
view.stopListening(model);
}
}
module ModelAndCollection {
function test_url() {
Employee.prototype.url = () => '/employees';
EmployeeCollection.prototype.url = () => '/employees';
}
function test_parse() {
var model = new Employee();
model.parse('{}', {});
var collection = new EmployeeCollection;
collection.parse('{}', {});
}
function test_toJSON() {
var model = new Employee();
model.toJSON({});
var collection = new EmployeeCollection;
collection.toJSON({});
}
function test_sync() {
var model = new Employee();
model.sync();
var collection = new EmployeeCollection;
collection.sync();
}
}
module Model {
function test_validationError() {
var model = new Employee;
if (model.validationError) {
console.log('has validation errors');
}
}
function test_fetch() {
var model = new Employee({ id: 1 });
model.fetch({
success: () => { },
error: () => { }
});
}
function test_set() {
var model = new Employee;
model.set({ name: 'JoeDoe', age: 21 }, { validate: false });
model.set('name', 'JoeDoes', { validate: false });
}
function test_destroy() {
var model = new Employee;
model.destroy({
wait: true,
success: (m?, response?, options?) => { },
error: (m?, jqxhr?, options?) => { }
});
model.destroy({
success: (m?, response?, options?) => { },
error: (m?, jqxhr?) => { }
});
model.destroy({
success: () => { },
error: (m?, jqxhr?) => { }
});
}
function test_save() {
var model = new Employee;
model.save({
name: 'Joe Doe',
age: 21
},
{
wait: true,
validate: false,
success: (m?, response?, options?) => { },
error: (m?, jqxhr?, options?) => { }
});
model.save({
name: 'Joe Doe',
age: 21
},
{
success: () => { },
error: (m?, jqxhr?) => { }
});
}
function test_validate() {
var model = new Employee;
model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false })
}
}
module Collection {
function test_fetch() {
var collection = new EmployeeCollection;
collection.fetch({ reset: true });
}
function test_create() {
var collection = new EmployeeCollection;
var model = new Employee;
collection.create(model, {
validate: false
});
}
}
module Router {
function test_navigate() {
var router = new Backbone.Router;
router.navigate('/employees', { trigger: true });
router.navigate('/employees', true);
}
}
}
/// <reference path="./backbone-global.d.ts" />
function test_events() {
var object = new Backbone.Events();
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
object.trigger("alert", "an event");
var onChange = () => alert('whatever');
var context: any;
object.off("change", onChange);
object.off("change");
object.off(null, onChange);
object.off(null, null, context);
object.off();
}
class SettingDefaults extends Backbone.Model {
// 'defaults' could be set in one of the following ways:
defaults() {
return {
name: "Joe"
}
}
constructor(attributes?: any, options?: any) {
this.defaults = <any>{
name: "Joe"
}
// super has to come last
super(attributes, options);
}
// or set it like this
initialize() {
this.defaults = <any>{
name: "Joe"
}
}
// same patterns could be used for setting 'Router.routes' and 'View.events'
}
class Sidebar extends Backbone.Model {
promptColor() {
var cssColor = prompt("Please enter a CSS color:");
this.set({ color: cssColor });
}
}
class Note extends Backbone.Model {
initialize() { }
author() { }
coordinates() { }
allowedToEdit(account: any) {
return true;
}
}
class PrivateNote extends Note {
allowedToEdit(account: any) {
return account.owns(this);
}
set(attributes: any, options?: any): Backbone.Model {
return Backbone.Model.prototype.set.call(this, attributes, options);
}
}
function test_models() {
var sidebar = new Sidebar();
sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color }));
sidebar.set({ color: 'white' });
sidebar.promptColor();
//////////
var note = new PrivateNote();
note.get("title");
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
note.set("title", "A Scandal in Bohemia");
}
class Employee extends Backbone.Model {
reports: EmployeeCollection;
constructor(attributes?: any, options?: any) {
super(options);
this.reports = new EmployeeCollection();
this.reports.url = '../api/employees/' + this.id + '/reports';
}
more() {
this.reports.reset();
}
}
class EmployeeCollection extends Backbone.Collection<Employee> {
findByName(key: any) { }
}
class Book extends Backbone.Model {
title: string;
author: string;
published: boolean;
}
class Library extends Backbone.Collection<Book> {
// This model definition is here only to test type compatibility of the model, but it
// is not necessary in working code as it is automatically inferred through generics.
model: typeof Book;
}
class Books extends Backbone.Collection<Book> { }
function test_collection() {
var books = new Books();
var book1: Book = new Book({ title: "Title 1", author: "Mike" });
books.add(book1);
// Objects can be added to collection by casting to model type.
// Compiler will check if object properties are valid for the cast.
// This gives better type checking than declaring an `any` overload.
books.add(<Book>{ title: "Title 2", author: "Mikey" });
var model: Book = book1.collection.first();
if (model !== book1) {
throw new Error("Error");
}
books.each(book =>
book.get("title"));
var titles = books.map(book =>
book.get("title"));
var publishedBooks = books.filter(book =>
book.get("published") === true);
var alphabetical = books.sortBy((book: Book): number => null);
}
//////////
Backbone.history.start();
module v1Changes {
module events {
function test_once() {
var model = new Employee;
model.once('invalid', () => { }, this);
model.once('invalid', () => { });
}
function test_listenTo() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.listenTo(model, 'invalid', () => { });
}
function test_listenToOnce() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.listenToOnce(model, 'invalid', () => { });
}
function test_stopListening() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.stopListening(model, 'invalid', () => { });
view.stopListening(model, 'invalid');
view.stopListening(model);
}
}
module ModelAndCollection {
function test_url() {
Employee.prototype.url = () => '/employees';
EmployeeCollection.prototype.url = () => '/employees';
}
function test_parse() {
var model = new Employee();
model.parse('{}', {});
var collection = new EmployeeCollection;
collection.parse('{}', {});
}
function test_toJSON() {
var model = new Employee();
model.toJSON({});
var collection = new EmployeeCollection;
collection.toJSON({});
}
function test_sync() {
var model = new Employee();
model.sync();
var collection = new EmployeeCollection;
collection.sync();
}
}
module Model {
function test_validationError() {
var model = new Employee;
if (model.validationError) {
console.log('has validation errors');
}
}
function test_fetch() {
var model = new Employee({ id: 1 });
model.fetch({
success: () => { },
error: () => { }
});
}
function test_set() {
var model = new Employee;
model.set({ name: 'JoeDoe', age: 21 }, { validate: false });
model.set('name', 'JoeDoes', { validate: false });
}
function test_destroy() {
var model = new Employee;
model.destroy({
wait: true,
success: (m?, response?, options?) => { },
error: (m?, jqxhr?, options?) => { }
});
model.destroy({
success: (m?, response?, options?) => { },
error: (m?, jqxhr?) => { }
});
model.destroy({
success: () => { },
error: (m?, jqxhr?) => { }
});
}
function test_save() {
var model = new Employee;
model.save({
name: 'Joe Doe',
age: 21
},
{
wait: true,
validate: false,
success: (m?, response?, options?) => { },
error: (m?, jqxhr?, options?) => { }
});
model.save({
name: 'Joe Doe',
age: 21
},
{
success: () => { },
error: (m?, jqxhr?) => { }
});
}
function test_validate() {
var model = new Employee;
model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false })
}
}
module Collection {
function test_fetch() {
var collection = new EmployeeCollection;
collection.fetch({ reset: true });
}
function test_create() {
var collection = new EmployeeCollection;
var model = new Employee;
collection.create(model, {
validate: false
});
}
}
module Router {
function test_navigate() {
var router = new Backbone.Router;
router.navigate('/employees', { trigger: true });
router.navigate('/employees', true);
}
}
}

View File

@@ -1,229 +1,229 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="dynatable.d.ts"/>
// Using the global setup option
// =============================
$.dynatableSetup({ features: { pushState: false }, dataset: { perPageDefault: 5, perPageOptions: [2, 5, 10] } });
// Without any settings (using all defaults)
// =========================================
var dynatableWithDefaultSettings = $('#example-table').dynatable();
// Building a config piece by piece
// ================================
// JQueryDynatable.Features
var featsConfig: JQueryDynatable.Features = {
paginate: true,
sort: false,
pushState: true,
search: true,
recordCount: true,
perPageSelect: true
};
var featsPartialConfig: JQueryDynatable.Features = {
search: false,
paginate: false
};
// JQueryDynatable.Column
var col: JQueryDynatable.Column = {
index: 0,
label: 'Col from JS',
id: 'someColId',
attributeWriter: function myAttrWriter(data: any): any {
return data[this.id];
},
attributeReader: function myAttrReader(cell: Element, data: any): string {
return $(cell).html();
},
sorts: ['un', 'deux'],
hidden: false,
textAlign: 'right'
};
// JQueryDynatable.Table
var tableConfig: JQueryDynatable.Table = {
defaultColumnIdStyle: 'underscore',
columns: [col], // Just for fun & testing... because will be reset by dynatable
headRowSelector: '.my-head-row-selector',
bodyRowSelector: 'tbody tr',
headRowClass: 'custom-head-row-class'
};
var tablePartialConfig: JQueryDynatable.Table = {
defaultColumnIdStyle: 'trimDash'
};
// JQueryDynatable.Inputs
var tableInputs: JQueryDynatable.Inputs = {
// Must match exactly target value, strict comparison!
queries: $('#countryFilter, #yearFilter'),
// I believe this setting is unused!
sorts: null,
multisort: ['shiftKey'],
// I believe this setting is unused!
page: null,
queryEvent: 'keyup',
recordCountTarget: $('#record-count'),
recordCountPlacement: 'after',
paginationLinkTarget: '#record-count',
paginationLinkPlacement: 'before',
paginationClass: 'paginationClass',
paginationLinkClass: 'paginationLinkClass',
paginationPrevClass: 'paginationPrevClass',
paginationNextClass: 'paginationNextClass',
paginationActiveClass: 'paginationActiveClass',
paginationDisabledClass: 'paginationDisabledClass',
paginationPrev: '&lt; Prev.',
paginationNext: 'Next &gt;',
paginationGap: [3, 1, 1, 3],
searchTarget: $('#record-count').get(0),
searchPlacement: 'after',
searchText: 'Search: ',
perPageTarget: '#record-count',
perPagePlacement: 'before',
perPageText: 'Display: ',
pageText: 'Pages: ',
recordCountPageBoundTemplate: '{pageLowerBound} t-o {pageUpperBound} o-f',
recordCountPageUnboundedTemplate: '{recordsShown} -of-',
recordCountTotalTemplate: '{recordsQueryCount} x {collectionName}',
recordCountFilteredTemplate: ' (found from {recordsTotal} total entries)',
recordCountText: 'Rendering',
recordCountTextTemplate: '{text} {pageTemplate} {totalTemplate} {filteredTemplate}',
recordCountTemplate: '<span id="dynatable-record-count-{elementId}" class="dynatable-record-count">!!{textTemplate}!!</span>',
processingText: 'Working...'
};
// JQueryDynatable.Dataset
var tableDataset: JQueryDynatable.Dataset = {
ajax: false,
ajaxUrl: null,
ajaxCache: null,
ajaxOnLoad: false,
ajaxMethod: 'GET',
ajaxDataType: 'json',
totalRecordCount: null,
queries: {},
queryRecordCount: null,
page: null,
perPageDefault: 3,
perPageOptions: [2, 3, 10],
sorts: {},
sortsKeys: [],
sortTypes: {},
records: null
};
// JQueryDynatable.Writers
var tableWriters: JQueryDynatable.Writers = {
_rowWriter: function exampleRowWriter(rowIndex, record, columns, cellWriter) {
var tr = '';
// grab the record's attribute for each column
for (var i = 0, len = columns.length; i < len; i++) {
tr += cellWriter(columns[i], record);
}
return '<tr>' + tr + '</tr>';
},
_cellWriter: function exampleCellWriter(column, record) {
var html = column.attributeWriter(record),
td = '<td';
if (column.hidden || column.textAlign) {
td += ' style="';
// keep cells for hidden column headers hidden
if (column.hidden) {
td += 'display: none;';
}
// keep cells aligned as their column headers are aligned
if (column.textAlign) {
td += 'text-align: ' + column.textAlign + ';';
}
td += '"';
}
return td + '>' + html + '</td>';
},
_attributeWriter: function exampleAttributeWriter(record) {
// `this` is the column object in settings.columns
return record[this.id];
}
};
// JQueryDynatable.Readers
var tableReaders: JQueryDynatable.Readers = {
_rowReader: null,
_attributeReader: function exampleAttributeReader(cell, record) {
return $(cell).html();
}
};
// JQueryDynatable.Params
var tableParams: JQueryDynatable.Params = {
dynatable: 'dynatable',
queries: 'queries',
sorts: 'sorts',
page: 'page',
perPage: 'perPage',
offset: 'offset',
records: 'records',
record: null,
queryRecordCount: 'queryRecordCount',
totalRecordCount: 'totalRecordCount'
};
var dynatableOptions: JQueryDynatable.Options = {
// Grouping config components
features: featsConfig,
table: tableConfig,
inputs: tableInputs,
dataset: tableDataset,
writers: tableWriters,
readers: tableReaders,
params: tableParams
};
// Init with the options
var dynatableWithOptions = $('#example-with-options').dynatable(dynatableOptions);
// Inline config
// =============
// Init with the options
var dynatableWithInlineOptions = $('#example-with-inline-options').dynatable({
features: {
paginate: false,
search: false,
sort: true
}
});
// Using $element
// ==============
var dtable: JQueryDynatable.Dynatable = $('#testing-element').dynatable().data('dynatable');
dtable.$element.addClass('some-class-to-be-added-on-the-element');
// Using the API
// =============
// domColumns API
dtable.domColumns.add($('<th>A</th>'), 0, false, true);
dtable.domColumns.add($('<th>B</th>'), 1, false, true);
// dom API
dtable.dom.update(); // update the dom with the current record set
// paginationPage API
dtable.paginationPage.set(2);
// paginationPerPage API
dtable.paginationPerPage.set(1, true);
// processingIndicator API
setTimeout(function() { dtable.processingIndicator.show(); }, 1000);
setTimeout(function() { dtable.processingIndicator.hide(); }, 3000);
// queries API
// records API
// recordsCount API
// settings API
// sorts API
dtable.sorts.clear();
dtable.sorts.add('theRank', -1) // 1=ASCENDING, -1=DESCENDING
dtable.sorts.remove('country');
dtable.process();
// sortsHeaders API
// state API
// Creating a Custom Sort Function
// dynatable.queries.functions['max-price'] = function(record, queryValue) {
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="dynatable.d.ts"/>
// Using the global setup option
// =============================
$.dynatableSetup({ features: { pushState: false }, dataset: { perPageDefault: 5, perPageOptions: [2, 5, 10] } });
// Without any settings (using all defaults)
// =========================================
var dynatableWithDefaultSettings = $('#example-table').dynatable();
// Building a config piece by piece
// ================================
// JQueryDynatable.Features
var featsConfig: JQueryDynatable.Features = {
paginate: true,
sort: false,
pushState: true,
search: true,
recordCount: true,
perPageSelect: true
};
var featsPartialConfig: JQueryDynatable.Features = {
search: false,
paginate: false
};
// JQueryDynatable.Column
var col: JQueryDynatable.Column = {
index: 0,
label: 'Col from JS',
id: 'someColId',
attributeWriter: function myAttrWriter(data: any): any {
return data[this.id];
},
attributeReader: function myAttrReader(cell: Element, data: any): string {
return $(cell).html();
},
sorts: ['un', 'deux'],
hidden: false,
textAlign: 'right'
};
// JQueryDynatable.Table
var tableConfig: JQueryDynatable.Table = {
defaultColumnIdStyle: 'underscore',
columns: [col], // Just for fun & testing... because will be reset by dynatable
headRowSelector: '.my-head-row-selector',
bodyRowSelector: 'tbody tr',
headRowClass: 'custom-head-row-class'
};
var tablePartialConfig: JQueryDynatable.Table = {
defaultColumnIdStyle: 'trimDash'
};
// JQueryDynatable.Inputs
var tableInputs: JQueryDynatable.Inputs = {
// Must match exactly target value, strict comparison!
queries: $('#countryFilter, #yearFilter'),
// I believe this setting is unused!
sorts: null,
multisort: ['shiftKey'],
// I believe this setting is unused!
page: null,
queryEvent: 'keyup',
recordCountTarget: $('#record-count'),
recordCountPlacement: 'after',
paginationLinkTarget: '#record-count',
paginationLinkPlacement: 'before',
paginationClass: 'paginationClass',
paginationLinkClass: 'paginationLinkClass',
paginationPrevClass: 'paginationPrevClass',
paginationNextClass: 'paginationNextClass',
paginationActiveClass: 'paginationActiveClass',
paginationDisabledClass: 'paginationDisabledClass',
paginationPrev: '&lt; Prev.',
paginationNext: 'Next &gt;',
paginationGap: [3, 1, 1, 3],
searchTarget: $('#record-count').get(0),
searchPlacement: 'after',
searchText: 'Search: ',
perPageTarget: '#record-count',
perPagePlacement: 'before',
perPageText: 'Display: ',
pageText: 'Pages: ',
recordCountPageBoundTemplate: '{pageLowerBound} t-o {pageUpperBound} o-f',
recordCountPageUnboundedTemplate: '{recordsShown} -of-',
recordCountTotalTemplate: '{recordsQueryCount} x {collectionName}',
recordCountFilteredTemplate: ' (found from {recordsTotal} total entries)',
recordCountText: 'Rendering',
recordCountTextTemplate: '{text} {pageTemplate} {totalTemplate} {filteredTemplate}',
recordCountTemplate: '<span id="dynatable-record-count-{elementId}" class="dynatable-record-count">!!{textTemplate}!!</span>',
processingText: 'Working...'
};
// JQueryDynatable.Dataset
var tableDataset: JQueryDynatable.Dataset = {
ajax: false,
ajaxUrl: null,
ajaxCache: null,
ajaxOnLoad: false,
ajaxMethod: 'GET',
ajaxDataType: 'json',
totalRecordCount: null,
queries: {},
queryRecordCount: null,
page: null,
perPageDefault: 3,
perPageOptions: [2, 3, 10],
sorts: {},
sortsKeys: [],
sortTypes: {},
records: null
};
// JQueryDynatable.Writers
var tableWriters: JQueryDynatable.Writers = {
_rowWriter: function exampleRowWriter(rowIndex, record, columns, cellWriter) {
var tr = '';
// grab the record's attribute for each column
for (var i = 0, len = columns.length; i < len; i++) {
tr += cellWriter(columns[i], record);
}
return '<tr>' + tr + '</tr>';
},
_cellWriter: function exampleCellWriter(column, record) {
var html = column.attributeWriter(record),
td = '<td';
if (column.hidden || column.textAlign) {
td += ' style="';
// keep cells for hidden column headers hidden
if (column.hidden) {
td += 'display: none;';
}
// keep cells aligned as their column headers are aligned
if (column.textAlign) {
td += 'text-align: ' + column.textAlign + ';';
}
td += '"';
}
return td + '>' + html + '</td>';
},
_attributeWriter: function exampleAttributeWriter(record) {
// `this` is the column object in settings.columns
return record[this.id];
}
};
// JQueryDynatable.Readers
var tableReaders: JQueryDynatable.Readers = {
_rowReader: null,
_attributeReader: function exampleAttributeReader(cell, record) {
return $(cell).html();
}
};
// JQueryDynatable.Params
var tableParams: JQueryDynatable.Params = {
dynatable: 'dynatable',
queries: 'queries',
sorts: 'sorts',
page: 'page',
perPage: 'perPage',
offset: 'offset',
records: 'records',
record: null,
queryRecordCount: 'queryRecordCount',
totalRecordCount: 'totalRecordCount'
};
var dynatableOptions: JQueryDynatable.Options = {
// Grouping config components
features: featsConfig,
table: tableConfig,
inputs: tableInputs,
dataset: tableDataset,
writers: tableWriters,
readers: tableReaders,
params: tableParams
};
// Init with the options
var dynatableWithOptions = $('#example-with-options').dynatable(dynatableOptions);
// Inline config
// =============
// Init with the options
var dynatableWithInlineOptions = $('#example-with-inline-options').dynatable({
features: {
paginate: false,
search: false,
sort: true
}
});
// Using $element
// ==============
var dtable: JQueryDynatable.Dynatable = $('#testing-element').dynatable().data('dynatable');
dtable.$element.addClass('some-class-to-be-added-on-the-element');
// Using the API
// =============
// domColumns API
dtable.domColumns.add($('<th>A</th>'), 0, false, true);
dtable.domColumns.add($('<th>B</th>'), 1, false, true);
// dom API
dtable.dom.update(); // update the dom with the current record set
// paginationPage API
dtable.paginationPage.set(2);
// paginationPerPage API
dtable.paginationPerPage.set(1, true);
// processingIndicator API
setTimeout(function() { dtable.processingIndicator.show(); }, 1000);
setTimeout(function() { dtable.processingIndicator.hide(); }, 3000);
// queries API
// records API
// recordsCount API
// settings API
// sorts API
dtable.sorts.clear();
dtable.sorts.add('theRank', -1) // 1=ASCENDING, -1=DESCENDING
dtable.sorts.remove('country');
dtable.process();
// sortsHeaders API
// state API
// Creating a Custom Sort Function
// dynatable.queries.functions['max-price'] = function(record, queryValue) {

2310
dynatable/dynatable.d.ts vendored

File diff suppressed because it is too large Load Diff

320
i18next/i18next.d.ts vendored
View File

@@ -1,160 +1,160 @@
// Type definitions for i18next v2.0.17
// Project: http://i18next.com
// Definitions by: Maarten Docter <https://github.com/mdocter>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Sources: https://github.com/jamuhl/i18next/
/// <reference path="../express/express.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../i18next-express-middleware/i18next-express-middleware.d.ts" />
/// <reference path="../i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts" />
interface IResourceStore {
[language: string]: IResourceStoreLanguage;
}
interface IResourceStoreLanguage {
[namespace: string]: IResourceStoreKey;
}
interface IResourceStoreKey {
[key: string]: any;
}
interface I18nTranslateOptions extends I18nextOptions {
defaultValue?: any; // normally a string
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
toAdd?: any;
child?: any;
sprintf?: any;
count?: any;
context?: any;
}
interface i18nextSprintfPostProcessorStatic {
overloadTranslationOptionHandler?(args: Array<any>): void;
process?(value: any, key: string, options: Object): void;
}
interface I18nextOptions extends i18nextSprintfPostProcessorStatic {
lng?: string; // Default value: undefined
load?: string; // Default value: 'all'
preload?: string[]; // Default value: []
lowerCaseLng?: boolean; // Default value: false
returnObjectTrees?: boolean; // Default value: false
fallbackLng?: string|boolean; // Default value: 'dev'
detectLngQS?: string; // Default value: 'setLng'
ns?: any; // Default value: 'translation' (string), can also be an object
nsseparator?: string; // Default value: '::'
keyseparator?: string; // Default value: '.'
selectorAttr?: string; // Default value: 'data-i18n'
debug?: boolean; // Default value: false
resGetPath?: string; // Default value: 'locales/__lng__/__ns__.json'
resPostPath?: string; // Default value: 'locales/add/__lng__/__ns__'
getAsync?: boolean; // Default value: true
postAsync?: boolean; // Default value: true
resStore?: IResourceStore; // Default value: undefined
useLocalStorage?: boolean; // Default value: false
localStorageExpirationTime?: number; // Default value: 7 * 24 * 60 * 60 * 1000 (in ms default one week)
dynamicLoad?: boolean; // Default value: false
sendMissing?: boolean; // Default value: false
sendMissingTo?: string; // Default value: 'fallback'. Other options are: current | all
sendType?: string; // Default value: 'POST'
interpolationPrefix?: string; // Default value: '__'
interpolationSuffix?: string; // Default value: '__'
reusePrefix?: string; // Default value: '$t('
reuseSuffix?: string; // Default value: ')'
pluralSuffix?: string; // Default value: '_plural'
pluralNotFound?: string; // Default value: ['plural_not_found' Math.random()].join( '' )
contextNotFound?: string; // Default value: ['context_not_found' Math.random()].join( '' )
setJqueryExt?: boolean; // Default value: true
defaultValueFromContent?: boolean; // Default value: true
useDataAttrOptions?: boolean; // Default value: false
cookieExpirationTime?: number; // Default value: undefined
useCookie?: boolean; // Default value: true
cookieName?: string; // Default value: 'i18next'
postProcess?: string; // Default value: undefined
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
replace?: any;
}
interface I18nextStatic {
addPostProcessor(name: string, fn: (value: any, key: string, options: any) => string): void;
addResources(language: string, namespace: string, resources: IResourceStoreKey): void;
detectLanguage(): string;
functions: {
extend(target: any, ...objs: any[]): Object;
extend(deep: boolean, target: any, ...objs: any[]): Object;
each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;
ajax(settings: JQueryAjaxSettings): JQueryXHR;
ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
cookie: {
create: (name: string, value: string, minutes: number) => void;
read: (name: string) => string;
remove: (name: string) => void;
};
detectLanguage(): string;
log(message: string): void;
toLanguages(language: string): string[];
regexEscape(str: string): string;
};
init(callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
init(options?: I18nextOptions|any, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>; // NOTE: remove any for 'options' parameter.
lng(): string;
loadNamespace(namespace: string, callback?: () => void ): void;
loadNamespaces(namespaces: string[], callback?: () => void ): void;
pluralExtensions: {
addRule(language: string, obj: {
name: string;
numbers: number[];
plurals: (n: number) => number;
}): void;
get (language: string, count: number): number;
rules: any;
setCurrentLng: (language: string) => void;
};
preload(language: string, callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
preload(languages: string[], callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
setDefaultNamespace(namespace: string): void;
setLng(language: string, callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
sync: {
load: (languages: string[], options: I18nextOptions, callback: (err: Error, store: IResourceStore) => void ) => void;
postMissing: (language: string, namespace: string, key: string, defaultValue: any, languages: string[]) => void;
};
t(key: string, options?: I18nTranslateOptions): string;
translate(key: string, options?: I18nTranslateOptions): string;
exists(key: string, options?: any): boolean;
use(module: any): I18nextStatic;
}
// jQuery extensions
interface JQueryStatic {
i18n: I18nextStatic;
t: (key: string, options?: any) => string;
}
interface JQuery {
/* Note: options are same options as used by the translate function. Alternatively by
setting init option or translation option 'useDataAttrOptions = true' the Options
for translation will be read and cached in the elements data-i18n-options attribute.
*/
i18n: (options?: I18nextOptions) => void;
}
declare var i18n: I18nextStatic;
declare module 'i18next' {
export = i18n;
}
declare module 'i18next-client' {
export = i18n;
}
// Type definitions for i18next v2.0.17
// Project: http://i18next.com
// Definitions by: Maarten Docter <https://github.com/mdocter>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Sources: https://github.com/jamuhl/i18next/
/// <reference path="../express/express.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../i18next-express-middleware/i18next-express-middleware.d.ts" />
/// <reference path="../i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts" />
interface IResourceStore {
[language: string]: IResourceStoreLanguage;
}
interface IResourceStoreLanguage {
[namespace: string]: IResourceStoreKey;
}
interface IResourceStoreKey {
[key: string]: any;
}
interface I18nTranslateOptions extends I18nextOptions {
defaultValue?: any; // normally a string
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
toAdd?: any;
child?: any;
sprintf?: any;
count?: any;
context?: any;
}
interface i18nextSprintfPostProcessorStatic {
overloadTranslationOptionHandler?(args: Array<any>): void;
process?(value: any, key: string, options: Object): void;
}
interface I18nextOptions extends i18nextSprintfPostProcessorStatic {
lng?: string; // Default value: undefined
load?: string; // Default value: 'all'
preload?: string[]; // Default value: []
lowerCaseLng?: boolean; // Default value: false
returnObjectTrees?: boolean; // Default value: false
fallbackLng?: string|boolean; // Default value: 'dev'
detectLngQS?: string; // Default value: 'setLng'
ns?: any; // Default value: 'translation' (string), can also be an object
nsseparator?: string; // Default value: '::'
keyseparator?: string; // Default value: '.'
selectorAttr?: string; // Default value: 'data-i18n'
debug?: boolean; // Default value: false
resGetPath?: string; // Default value: 'locales/__lng__/__ns__.json'
resPostPath?: string; // Default value: 'locales/add/__lng__/__ns__'
getAsync?: boolean; // Default value: true
postAsync?: boolean; // Default value: true
resStore?: IResourceStore; // Default value: undefined
useLocalStorage?: boolean; // Default value: false
localStorageExpirationTime?: number; // Default value: 7 * 24 * 60 * 60 * 1000 (in ms default one week)
dynamicLoad?: boolean; // Default value: false
sendMissing?: boolean; // Default value: false
sendMissingTo?: string; // Default value: 'fallback'. Other options are: current | all
sendType?: string; // Default value: 'POST'
interpolationPrefix?: string; // Default value: '__'
interpolationSuffix?: string; // Default value: '__'
reusePrefix?: string; // Default value: '$t('
reuseSuffix?: string; // Default value: ')'
pluralSuffix?: string; // Default value: '_plural'
pluralNotFound?: string; // Default value: ['plural_not_found' Math.random()].join( '' )
contextNotFound?: string; // Default value: ['context_not_found' Math.random()].join( '' )
setJqueryExt?: boolean; // Default value: true
defaultValueFromContent?: boolean; // Default value: true
useDataAttrOptions?: boolean; // Default value: false
cookieExpirationTime?: number; // Default value: undefined
useCookie?: boolean; // Default value: true
cookieName?: string; // Default value: 'i18next'
postProcess?: string; // Default value: undefined
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
replace?: any;
}
interface I18nextStatic {
addPostProcessor(name: string, fn: (value: any, key: string, options: any) => string): void;
addResources(language: string, namespace: string, resources: IResourceStoreKey): void;
detectLanguage(): string;
functions: {
extend(target: any, ...objs: any[]): Object;
extend(deep: boolean, target: any, ...objs: any[]): Object;
each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;
ajax(settings: JQueryAjaxSettings): JQueryXHR;
ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
cookie: {
create: (name: string, value: string, minutes: number) => void;
read: (name: string) => string;
remove: (name: string) => void;
};
detectLanguage(): string;
log(message: string): void;
toLanguages(language: string): string[];
regexEscape(str: string): string;
};
init(callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
init(options?: I18nextOptions|any, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>; // NOTE: remove any for 'options' parameter.
lng(): string;
loadNamespace(namespace: string, callback?: () => void ): void;
loadNamespaces(namespaces: string[], callback?: () => void ): void;
pluralExtensions: {
addRule(language: string, obj: {
name: string;
numbers: number[];
plurals: (n: number) => number;
}): void;
get (language: string, count: number): number;
rules: any;
setCurrentLng: (language: string) => void;
};
preload(language: string, callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
preload(languages: string[], callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
setDefaultNamespace(namespace: string): void;
setLng(language: string, callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
sync: {
load: (languages: string[], options: I18nextOptions, callback: (err: Error, store: IResourceStore) => void ) => void;
postMissing: (language: string, namespace: string, key: string, defaultValue: any, languages: string[]) => void;
};
t(key: string, options?: I18nTranslateOptions): string;
translate(key: string, options?: I18nTranslateOptions): string;
exists(key: string, options?: any): boolean;
use(module: any): I18nextStatic;
}
// jQuery extensions
interface JQueryStatic {
i18n: I18nextStatic;
t: (key: string, options?: any) => string;
}
interface JQuery {
/* Note: options are same options as used by the translate function. Alternatively by
setting init option or translation option 'useDataAttrOptions = true' the Options
for translation will be read and cached in the elements data-i18n-options attribute.
*/
i18n: (options?: I18nextOptions) => void;
}
declare var i18n: I18nextStatic;
declare module 'i18next' {
export = i18n;
}
declare module 'i18next-client' {
export = i18n;
}

View File

@@ -1,86 +1,86 @@
/// <reference path="polymer.d.ts"/>
Polymer({
is: "my-element",
properties: {
prop1: String,
prop2: {
type: Boolean,
value: true,
readOnly: false,
reflectToAttribute: true,
notify: true,
computed: "__prop2()"
},
prop3: {
type: Object,
value: { "foo": "bar" },
},
},
hostAttributes: {
"string-attribute": 'Value',
"boolean-attribute": true,
tabindex: 0
},
ready: function () {
this.textContent = 'My element!';
this.$.name.textContent = this.name;
this.serialize({});
this.async(function () {
// access sibling or parent elements here
});
},
__prop2: function () {
var toLight = document.createElement('div');
Polymer.dom(this).appendChild(toLight);
var toLocal = document.createElement('div');
var beforeNode = Polymer.dom(this.root).childNodes[0];
Polymer.dom(this.root).insertBefore(toLocal, beforeNode);
var allSpans = Polymer.dom(this).querySelectorAll('span');
}
});
var MyElement = Polymer.Class(<polymer.Base>{
is: 'my-element',
created: function () {
this.textContent = 'My element!';
}
});
document.registerElement('my-element', MyElement);
// Equivalent:
var el1 = new MyElement();
var el2 = document.createElement('my-element');
// ES6 class syntax
// implicit implementation
class MyElement2 {
is: string;
beforeRegister() {
this.is = "my-element2";
}
}
Polymer(MyElement2);
// explicit implementation
class MyElement3 implements polymer.Base {
is: string;
beforeRegister() {
this.is = "my-element3";
}
}
Polymer(MyElement3);
/// <reference path="polymer.d.ts"/>
Polymer({
is: "my-element",
properties: {
prop1: String,
prop2: {
type: Boolean,
value: true,
readOnly: false,
reflectToAttribute: true,
notify: true,
computed: "__prop2()"
},
prop3: {
type: Object,
value: { "foo": "bar" },
},
},
hostAttributes: {
"string-attribute": 'Value',
"boolean-attribute": true,
tabindex: 0
},
ready: function () {
this.textContent = 'My element!';
this.$.name.textContent = this.name;
this.serialize({});
this.async(function () {
// access sibling or parent elements here
});
},
__prop2: function () {
var toLight = document.createElement('div');
Polymer.dom(this).appendChild(toLight);
var toLocal = document.createElement('div');
var beforeNode = Polymer.dom(this.root).childNodes[0];
Polymer.dom(this.root).insertBefore(toLocal, beforeNode);
var allSpans = Polymer.dom(this).querySelectorAll('span');
}
});
var MyElement = Polymer.Class(<polymer.Base>{
is: 'my-element',
created: function () {
this.textContent = 'My element!';
}
});
document.registerElement('my-element', MyElement);
// Equivalent:
var el1 = new MyElement();
var el2 = document.createElement('my-element');
// ES6 class syntax
// implicit implementation
class MyElement2 {
is: string;
beforeRegister() {
this.is = "my-element2";
}
}
Polymer(MyElement2);
// explicit implementation
class MyElement3 implements polymer.Base {
is: string;
beforeRegister() {
this.is = "my-element3";
}
}
Polymer(MyElement3);

23
sat/sat-tests.ts Normal file
View File

@@ -0,0 +1,23 @@
/// <reference path="sat.d.ts" />
class SatTest{
public vectorTest(){
let v1: SAT.Vector = new SAT.Vector(10, 10);
console.log("def: v1 - " + v1.x.toString() + v1.y.toString());
let v2: SAT.Vector = new SAT.Vector(20,20);
console.log("def: v2 - " + v2.x.toString() + v1.y.toString());
let v3: SAT.Vector = new SAT.Vector(30,30);
console.log("def: v3 -" + v3.x.toString() + v1.y.toString());
v2.copy(v1);
console.log("copy: v2 - " + v2.x.toString() + v2.y.toString());
v3 = v1.clone();
console.log("clone: v3 - " + v3.x.toString() + v3.y.toString());
v3.perp();
console.log("perp: v3 - " + v3.x.toString() + v3.y.toString());
}
}
let test = new SatTest;
test.vectorTest();

142
sat/sat.d.ts vendored Normal file
View File

@@ -0,0 +1,142 @@
// Type definitions for sat.js
// Project: https://github.com/jriecken/sat-js
// Definitions by: Hou,Chunlei <https://github.com/omni360>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module SAT {
/**
* This is a simple 2D vector/point class,Vector has two parameters {x},{y}.
*/
export class Vector {
/**
* @class Vector has two properties
* @param {number} x The x-coordinate of the Vector.
* @param {number} y The y-coordinate of the Vector.
*/
constructor(x: number, y: number);
x: number;
y: number;
copy(other: Vector): Vector;
clone(): Vector;
perp(): Vector;
rotate(angle: number): Vector;
reverse(): Vector;
normalize(): Vector;
add(other: Vector): Vector;
sub(other: Vector): Vector;
scale(x: number, y: number): Vector;
project(other: Vector): Vector;
projectN(other: Vector): Vector;
reflect(axis: Vector): Vector;
reflectN(axis: Vector): Vector;
dot(other: Vector): number;
len2(): number;
len(): number;
}
/**
* This is simple circle with a center {pos} position and radius {r}.
*/
export class Circle {
constructor(pos: Vector, r: number);
pos: Vector;
r: number;
}
export class Polygon {
constructor(pos: Vector, points: Vector[]);
pos: Vector;
points: Vector[];
angle: number;
offset: Vector;
calcPoints: Vector[];
edges: Vector[];
normals: Vector[];
setPoints(points: Vector[]): Polygon;
setAngle(angle: number): Polygon;
setOffset(offset: Vector): Polygon;
recalc(): Polygon;
rotate(angle: number): Polygon;
translate(x: number, y: number): Polygon;
getAABB(): Polygon;
}
export class Box {
constructor(pos: Vector, width: number, height: number);
pos: Vector;
w: number;
h: number;
toPolygon(): Polygon;
}
export class Response {
constructor();
a: any;
b: any;
overlap: number;
overlapN: Vector;
overlapV: Vector;
aInB: boolean;
bInA: boolean;
clear(): Response;
}
/**
* @function {pointInCircle} checks whether a given point {p} is inside the specified circle {c}.
* @param {Vector} p given a point to checks.
* @param {Circle} c check with a specified circle
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function pointInCircle(p: Vector, c: Circle): boolean;
/**
* @function {pointInPolygon} checks whether a given point [p] is inside a specified convex polygon.
* @param {Vector} p given a point to check.
* @param {Polygon} poly check with a spcified convex polygon.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function pointInPolygon(p: Vector, poly: Polygon): boolean;
/**
* @function {testCicleCircle} tests a collision between two {Circle}s, {a} and {b}.
* if a {response} is to be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Circle} a specified circle a to tests.
* @param {Circle} b spacified circle b to tests.
* @param {Response} response specified the result of a collision between two circle.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testCircleCircle(a: Circle, b: Circle, response?: Response): boolean;
/**
* @function {testPolygonCicle} tests a collision between a {Polygon} and a {Circle}. if a response is to
* be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Polygon} polygon specified a Polygon to tests a collision.
* @param {Circle} circle specified a Circle to tests a collision.
* @param {Response} response specified the result of a collision between a {Polygon} and a {Circle}.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testPolygonCircle(polygon: Polygon, circle: Circle, response?: Response): boolean;
/**
* @function {testCirclePolygon} tests a collision between a {Circle} and a {Polygon}. if a response is to
* be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Circle} circle specified a {Circle} to tests a collision.
* @param {Polygon} polygon specified a {Polygon} to tests a collision.
* @param {Response} response specified the result of a collision between a {Circle} and a {Polygon}.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testCirclePolygon(circle: Circle, polygon: Polygon, response?: Response): boolean;
/**
* @function {testPolygonPolygon} tests whether two polygons {a} and {b} collide.
* if a response is to be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Polygon} a specified a {Polygon} {a} to test a collision.
* @param {Polygon} b specified a {Polygon} {b} to test a collision.
* @param {Response} response specified the result of a collision between two {Polygon}s.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testPolygonPolygon(a: Polygon, b: Polygon, response?: Response): boolean;
}

1052
tedious/tedious.d.ts vendored

File diff suppressed because it is too large Load Diff

1366
teechart/teechart.d.ts vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

96
tmp/tmp.d.ts vendored
View File

@@ -1,48 +1,48 @@
// Type definitions for tmp v0.0.28
// Project: https://www.npmjs.com/package/tmp
// Definitions by: Jared Klopper <https://github.com/optical>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "tmp" {
module tmp {
interface Options extends SimpleOptions {
mode?: number;
}
interface SimpleOptions {
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
interface SynchrounousResult {
name: string;
fd: number;
removeCallback: () => void;
}
function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function fileSync(config?: Options): SynchrounousResult;
function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dirSync(config?: Options): SynchrounousResult;
function tmpName(callback: (err: any, path: string) => void): void;
function tmpName(config: SimpleOptions, callback?: (err: any, path: string) => void): void;
function tmpNameSync(config?: SimpleOptions): string;
function setGracefulCleanup(): void;
}
export = tmp;
}
// Type definitions for tmp v0.0.28
// Project: https://www.npmjs.com/package/tmp
// Definitions by: Jared Klopper <https://github.com/optical>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "tmp" {
module tmp {
interface Options extends SimpleOptions {
mode?: number;
}
interface SimpleOptions {
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
interface SynchrounousResult {
name: string;
fd: number;
removeCallback: () => void;
}
function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function fileSync(config?: Options): SynchrounousResult;
function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dirSync(config?: Options): SynchrounousResult;
function tmpName(callback: (err: any, path: string) => void): void;
function tmpName(config: SimpleOptions, callback?: (err: any, path: string) => void): void;
function tmpNameSync(config?: SimpleOptions): string;
function setGracefulCleanup(): void;
}
export = tmp;
}

200
tween.js/tween.js.d.ts vendored
View File

@@ -1,100 +1,100 @@
// Type definitions for tween.js r12
// Project: https://github.com/sole/tween.js/
// Definitions by: sunetos <https://github.com/sunetos>, jzarnikov <https://github.com/jzarnikov>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module TWEEN {
export var REVISION: string;
export function getAll(): Tween[];
export function removeAll(): void;
export function add(tween:Tween): void;
export function remove(tween:Tween): void;
export function update(time?:number): boolean;
export class Tween {
constructor(object?:any);
to(properties:any, duration:number): Tween;
start(time?:number): Tween;
stop(): Tween;
delay(amount:number): Tween;
easing(easing: (k: number) => number): Tween;
interpolation(interpolation: (v:number[], k:number) => number): Tween;
chain(...tweens:Tween[]): Tween;
onStart(callback: (object?: any) => void): Tween;
onUpdate(callback: (object?: any) => void): Tween;
onComplete(callback: (object?: any) => void): Tween;
update(time: number): boolean;
repeat(times: number): Tween;
yoyo(enable: boolean): Tween;
}
export var Easing: TweenEasing;
export var Interpolation: TweenInterpolation;
}
interface TweenEasing {
Linear: {
None(k:number): number;
};
Quadratic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Cubic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Quartic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Quintic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Sinusoidal: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Exponential: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Circular: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Elastic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Back: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Bounce: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
}
interface TweenInterpolation {
Linear(v:number[], k:number): number;
Bezier(v:number[], k:number): number;
CatmullRom(v:number[], k:number): number;
Utils: {
Linear(p0:number, p1:number, t:number): number;
Bernstein(n:number, i:number): number;
Factorial(n:number): number;
};
}
// Type definitions for tween.js r12
// Project: https://github.com/sole/tween.js/
// Definitions by: sunetos <https://github.com/sunetos>, jzarnikov <https://github.com/jzarnikov>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module TWEEN {
export var REVISION: string;
export function getAll(): Tween[];
export function removeAll(): void;
export function add(tween:Tween): void;
export function remove(tween:Tween): void;
export function update(time?:number): boolean;
export class Tween {
constructor(object?:any);
to(properties:any, duration:number): Tween;
start(time?:number): Tween;
stop(): Tween;
delay(amount:number): Tween;
easing(easing: (k: number) => number): Tween;
interpolation(interpolation: (v:number[], k:number) => number): Tween;
chain(...tweens:Tween[]): Tween;
onStart(callback: (object?: any) => void): Tween;
onUpdate(callback: (object?: any) => void): Tween;
onComplete(callback: (object?: any) => void): Tween;
update(time: number): boolean;
repeat(times: number): Tween;
yoyo(enable: boolean): Tween;
}
export var Easing: TweenEasing;
export var Interpolation: TweenInterpolation;
}
interface TweenEasing {
Linear: {
None(k:number): number;
};
Quadratic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Cubic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Quartic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Quintic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Sinusoidal: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Exponential: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Circular: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Elastic: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Back: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
Bounce: {
In(k:number): number;
Out(k:number): number;
InOut(k:number): number;
};
}
interface TweenInterpolation {
Linear(v:number[], k:number): number;
Bezier(v:number[], k:number): number;
CatmullRom(v:number[], k:number): number;
Utils: {
Linear(p0:number, p1:number, t:number): number;
Bernstein(n:number, i:number): number;
Factorial(n:number): number;
};
}

332
tweenjs/tweenjs.d.ts vendored
View File

@@ -1,166 +1,166 @@
// Type definitions for TweenJS 0.6.0
// Project: http://www.createjs.com/#!/TweenJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>
// 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.
*/
// Library documentation : http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html
/// <reference path="../createjs-lib/createjs-lib.d.ts" />
declare module createjs {
export class CSSPlugin {
constructor();
// properties
static cssSuffixMap: Object;
// methods
static install(): void;
}
export class Ease {
// methods
static backIn: (amount: number) => number;
static backInOut: (amount: number) => number;
static backOut: (amount: number) => number;
static bounceIn: (amount: number) => number;
static bounceInOut: (amount: number) => number;
static bounceOut: (amount: number) => number;
static circIn: (amount: number) => number;
static circInOut: (amount: number) => number;
static circOut: (amount: number) => number;
static cubicIn: (amount: number) => number;
static cubicInOut: (amount: number) => number;
static cubicOut: (amount: number) => number;
static elasticIn: (amount: number) => number;
static elasticInOut: (amount: number) => number;
static elasticOut: (amount: number) => number;
static get(amount: number): (amount: number) => number;
static getBackIn(amount: number): (amount: number) => number;
static getBackInOut(amount: number): (amount: number) => number;
static getBackOut(amount: number): (amount: number) => number;
static getElasticIn(amplitude: number, period: number): (amount: number) => number;
static getElasticInOut(amplitude: number, period: number): (amount: number) => number;
static getElasticOut(amplitude: number, period: number): (amount: number) => number;
static getPowIn(pow: number): (amount: number) => number;
static getPowInOut(pow: number): (amount: number) => number;
static getPowOut(pow: number): (amount: number) => number;
static linear: (amount: number) => number;
static none: (amount: number) => number; // same as linear
static quadIn: (amount: number) => number;
static quadInOut: (amount: number) => number;
static quadOut: (amount: number) => number;
static quartIn: (amount: number) => number;
static quartInOut: (amount: number) => number;
static quartOut: (amount: number) => number;
static quintIn: (amount: number) => number;
static quintInOut: (amount: number) => number;
static quintOut: (amount: number) => number;
static sineIn: (amount: number) => number;
static sineInOut: (amount: number) => number;
static sineOut: (amount: number) => number;
}
export class MotionGuidePlugin {
constructor();
//methods
static install(): Object;
}
/*
NOTE: It is commented out because it conflicts with SamplePlugin Class of PreloadJS.
this class is mainly for documentation purposes.
http://www.createjs.com/Docs/TweenJS/classes/SamplePlugin.html
*/
/*
export class SamplePlugin {
constructor();
// properties
static priority: any;
//methods
static init(tween: Tween, prop: string, value: any): any;
static step(tween: Tween, prop: string, startValue: any, injectProps: Object, endValue: any): void;
static install(): void;
static tween(tween: Tween, prop: string, value: any, startValues: Object, endValues: Object, ratio: number, wait: boolean, end: boolean): any;
}
*/
export class Timeline extends EventDispatcher {
constructor (tweens: Tween[], labels: Object, props: Object);
// properties
duration: number;
ignoreGlobalPause: boolean;
loop: boolean;
position: Object;
// methods
addLabel(label: string, position: number): void;
addTween(...tween: Tween[]): void;
getCurrentLabel(): string;
getLabels(): Object[];
gotoAndPlay(positionOrLabel: string | number): void;
gotoAndStop(positionOrLabel: string | number): void;
removeTween(...tween: Tween[]): void;
resolve(positionOrLabel: string | number): number;
setLabels(o: Object): void;
setPaused(value: boolean): void;
setPosition(value: number, actionsMode?: number): boolean;
tick(delta: number): void;
updateDuration(): void;
}
export class Tween extends EventDispatcher {
constructor(target: Object, props?: Object, pluginData?: Object);
// properties
duration: number;
static IGNORE: Object;
ignoreGlobalPause: boolean;
static LOOP: number;
loop: boolean;
static NONE: number;
onChange: Function; // deprecated
passive: boolean;
pluginData: Object;
position: number;
static REVERSE: number;
target: Object;
// methods
call(callback: (tweenObject: Tween) => any, params?: any[], scope?: Object): Tween; // when 'params' isn't given, the callback receives a tweenObject
call(callback: (...params: any[]) => any, params?: any[], scope?: Object): Tween; // otherwise, it receives the params only
static get(target: Object, props?: Object, pluginData?: Object, override?: boolean): Tween;
static hasActiveTweens(target?: Object): boolean;
static installPlugin(plugin: Object, properties: any[]): void;
pause(tween: Tween): Tween;
play(tween: Tween): Tween;
static removeAllTweens(): void;
static removeTweens(target: Object): void;
set(props: Object, target?: Object): Tween;
setPaused(value: boolean): Tween;
setPosition(value: number, actionsMode: number): boolean;
static tick(delta: number, paused: boolean): void;
tick(delta: number): void;
to(props: Object, duration?: number, ease?: (t: number) => number): Tween;
wait(duration: number, passive?: boolean): Tween;
}
export class TweenJS {
// properties
static buildDate: string;
static version: string;
}
}
// Type definitions for TweenJS 0.6.0
// Project: http://www.createjs.com/#!/TweenJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>
// 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.
*/
// Library documentation : http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html
/// <reference path="../createjs-lib/createjs-lib.d.ts" />
declare module createjs {
export class CSSPlugin {
constructor();
// properties
static cssSuffixMap: Object;
// methods
static install(): void;
}
export class Ease {
// methods
static backIn: (amount: number) => number;
static backInOut: (amount: number) => number;
static backOut: (amount: number) => number;
static bounceIn: (amount: number) => number;
static bounceInOut: (amount: number) => number;
static bounceOut: (amount: number) => number;
static circIn: (amount: number) => number;
static circInOut: (amount: number) => number;
static circOut: (amount: number) => number;
static cubicIn: (amount: number) => number;
static cubicInOut: (amount: number) => number;
static cubicOut: (amount: number) => number;
static elasticIn: (amount: number) => number;
static elasticInOut: (amount: number) => number;
static elasticOut: (amount: number) => number;
static get(amount: number): (amount: number) => number;
static getBackIn(amount: number): (amount: number) => number;
static getBackInOut(amount: number): (amount: number) => number;
static getBackOut(amount: number): (amount: number) => number;
static getElasticIn(amplitude: number, period: number): (amount: number) => number;
static getElasticInOut(amplitude: number, period: number): (amount: number) => number;
static getElasticOut(amplitude: number, period: number): (amount: number) => number;
static getPowIn(pow: number): (amount: number) => number;
static getPowInOut(pow: number): (amount: number) => number;
static getPowOut(pow: number): (amount: number) => number;
static linear: (amount: number) => number;
static none: (amount: number) => number; // same as linear
static quadIn: (amount: number) => number;
static quadInOut: (amount: number) => number;
static quadOut: (amount: number) => number;
static quartIn: (amount: number) => number;
static quartInOut: (amount: number) => number;
static quartOut: (amount: number) => number;
static quintIn: (amount: number) => number;
static quintInOut: (amount: number) => number;
static quintOut: (amount: number) => number;
static sineIn: (amount: number) => number;
static sineInOut: (amount: number) => number;
static sineOut: (amount: number) => number;
}
export class MotionGuidePlugin {
constructor();
//methods
static install(): Object;
}
/*
NOTE: It is commented out because it conflicts with SamplePlugin Class of PreloadJS.
this class is mainly for documentation purposes.
http://www.createjs.com/Docs/TweenJS/classes/SamplePlugin.html
*/
/*
export class SamplePlugin {
constructor();
// properties
static priority: any;
//methods
static init(tween: Tween, prop: string, value: any): any;
static step(tween: Tween, prop: string, startValue: any, injectProps: Object, endValue: any): void;
static install(): void;
static tween(tween: Tween, prop: string, value: any, startValues: Object, endValues: Object, ratio: number, wait: boolean, end: boolean): any;
}
*/
export class Timeline extends EventDispatcher {
constructor (tweens: Tween[], labels: Object, props: Object);
// properties
duration: number;
ignoreGlobalPause: boolean;
loop: boolean;
position: Object;
// methods
addLabel(label: string, position: number): void;
addTween(...tween: Tween[]): void;
getCurrentLabel(): string;
getLabels(): Object[];
gotoAndPlay(positionOrLabel: string | number): void;
gotoAndStop(positionOrLabel: string | number): void;
removeTween(...tween: Tween[]): void;
resolve(positionOrLabel: string | number): number;
setLabels(o: Object): void;
setPaused(value: boolean): void;
setPosition(value: number, actionsMode?: number): boolean;
tick(delta: number): void;
updateDuration(): void;
}
export class Tween extends EventDispatcher {
constructor(target: Object, props?: Object, pluginData?: Object);
// properties
duration: number;
static IGNORE: Object;
ignoreGlobalPause: boolean;
static LOOP: number;
loop: boolean;
static NONE: number;
onChange: Function; // deprecated
passive: boolean;
pluginData: Object;
position: number;
static REVERSE: number;
target: Object;
// methods
call(callback: (tweenObject: Tween) => any, params?: any[], scope?: Object): Tween; // when 'params' isn't given, the callback receives a tweenObject
call(callback: (...params: any[]) => any, params?: any[], scope?: Object): Tween; // otherwise, it receives the params only
static get(target: Object, props?: Object, pluginData?: Object, override?: boolean): Tween;
static hasActiveTweens(target?: Object): boolean;
static installPlugin(plugin: Object, properties: any[]): void;
pause(tween: Tween): Tween;
play(tween: Tween): Tween;
static removeAllTweens(): void;
static removeTweens(target: Object): void;
set(props: Object, target?: Object): Tween;
setPaused(value: boolean): Tween;
setPosition(value: number, actionsMode: number): boolean;
static tick(delta: number, paused: boolean): void;
tick(delta: number): void;
to(props: Object, duration?: number, ease?: (t: number) => number): Tween;
wait(duration: number, passive?: boolean): Tween;
}
export class TweenJS {
// properties
static buildDate: string;
static version: string;
}
}

2414
typeahead/typeahead.d.ts vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,100 +1,100 @@
// Type definitions for Ubuntu Unity Web API 1.0
// Project: https://launchpad.net/libunity-webapps
// Definitions by: John Vrbanac <https://github.com/jmvrbanac>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface External {
getUnityObject(version:number):Unity;
}
declare class UnitySettings {
public name:String;
public iconUrl:String;
public onInit:Function;
}
declare enum UnityPlaybackState {
Playing,
Paused
}
declare class UnityTrackMetadata {
title:String;
// Optionals
album:String;
artist:String;
artLocation:String;
}
interface UnityMediaPlayer {
setTrack(trackMetadata:UnityTrackMetadata);
onPrevious(onPreviousCallback:Function);
onNext(onNextCallback:Function);
onPlayPause(onPlayPauseCallback:Function);
getPlaybackstate(response:Function);
setPlaybackstate(state:UnityPlaybackState);
setCanGoNext(cangonext:Boolean);
setCanGoPrev(cangoprev:Boolean);
setCanPlay(canplay:Boolean);
setCanPause(canpause:Boolean);
}
interface UnityNotification {
showNotification (summary:String, body:String, iconUrl?:String);
}
declare class UnityIndicatorProperties {
public count:Number;
public time:Date;
public iconURI:String;
public onIndicatorActivated:Function;
}
interface UnityMessagingIndicator {
showIndicator(name:String, indicatorProperties:UnityIndicatorProperties);
clearIndicator(name:String);
clearIndicators();
addAction(name:String, onActionInvoked:Function);
removeAction(name:String);
removeActions();
onPresenceChanged(onPresenceChanged:Function);
// This is suppose to be readonly, but i'm not sure how to do this
// in a definition file.
presence:String;
}
interface UnityLauncher {
setCount(count:number);
clearCount();
setProgress(progress:number);
clearProgress();
setUrgent(urgent:Boolean);
addAction(name:String, onActionInvoked:Function);
removeAction(name:String);
removeActions();
}
interface Unity {
init(settings:UnitySettings);
addAction(name:String, callback:Function);
removeAction(actionName:String);
removeActions();
Notification:UnityNotification;
MediaPlayer:UnityMediaPlayer;
MessagingIndicator:UnityMessagingIndicator;
Launcher:UnityLauncher;
}
interface BrowserPublic {
getUnityObject(version:number):Unity;
}
// Type definitions for Ubuntu Unity Web API 1.0
// Project: https://launchpad.net/libunity-webapps
// Definitions by: John Vrbanac <https://github.com/jmvrbanac>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface External {
getUnityObject(version:number):Unity;
}
declare class UnitySettings {
public name:String;
public iconUrl:String;
public onInit:Function;
}
declare enum UnityPlaybackState {
Playing,
Paused
}
declare class UnityTrackMetadata {
title:String;
// Optionals
album:String;
artist:String;
artLocation:String;
}
interface UnityMediaPlayer {
setTrack(trackMetadata:UnityTrackMetadata);
onPrevious(onPreviousCallback:Function);
onNext(onNextCallback:Function);
onPlayPause(onPlayPauseCallback:Function);
getPlaybackstate(response:Function);
setPlaybackstate(state:UnityPlaybackState);
setCanGoNext(cangonext:Boolean);
setCanGoPrev(cangoprev:Boolean);
setCanPlay(canplay:Boolean);
setCanPause(canpause:Boolean);
}
interface UnityNotification {
showNotification (summary:String, body:String, iconUrl?:String);
}
declare class UnityIndicatorProperties {
public count:Number;
public time:Date;
public iconURI:String;
public onIndicatorActivated:Function;
}
interface UnityMessagingIndicator {
showIndicator(name:String, indicatorProperties:UnityIndicatorProperties);
clearIndicator(name:String);
clearIndicators();
addAction(name:String, onActionInvoked:Function);
removeAction(name:String);
removeActions();
onPresenceChanged(onPresenceChanged:Function);
// This is suppose to be readonly, but i'm not sure how to do this
// in a definition file.
presence:String;
}
interface UnityLauncher {
setCount(count:number);
clearCount();
setProgress(progress:number);
clearProgress();
setUrgent(urgent:Boolean);
addAction(name:String, onActionInvoked:Function);
removeAction(name:String);
removeActions();
}
interface Unity {
init(settings:UnitySettings);
addAction(name:String, callback:Function);
removeAction(actionName:String);
removeActions();
Notification:UnityNotification;
MediaPlayer:UnityMediaPlayer;
MessagingIndicator:UnityMessagingIndicator;
Launcher:UnityLauncher;
}
interface BrowserPublic {
getUnityObject(version:number):Unity;
}