mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
Merge pull request #65 from jmvrbanac/master
Add Ubuntu Unity Web API definition
This commit is contained in:
97
Definitions/unity-webapi-1.0.d.ts
vendored
Normal file
97
Definitions/unity-webapi-1.0.d.ts
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
// Type definitions for Ubuntu Unity Web API 1.0
|
||||
// Project: https://launchpad.net/libunity-webapps
|
||||
// Definitions by: John Vrbanac <john.vrbanac@linux.com> | https://github.com/jmvrbanac
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class UnitySettings {
|
||||
public name:String;
|
||||
public iconUrl:String;
|
||||
public onInit:Function;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
127
README.md
127
README.md
@@ -1,64 +1,65 @@
|
||||
DefinitelyTyped
|
||||
===============
|
||||
|
||||
TypeScript type definitions repository for popular JavaScript libraries.
|
||||
|
||||
The project aims to provide *high quality* definitions for the most popular libraries out there.
|
||||
|
||||
Complete
|
||||
--------
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [async](https://github.com/caolan/async)
|
||||
* [Backbone.js](http://backbonejs.org/)
|
||||
* [Bootstrap](http://twitter.github.com/bootstrap/)
|
||||
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/)
|
||||
* [dynatree](http://code.google.com/p/dynatree/) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [ember.js](http://emberjs.com/)
|
||||
* [Express](http://expressjs.com/)
|
||||
* [Fancybox](http://fancybox.net/)
|
||||
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
|
||||
* [Handlebars](http://handlebarsjs.com/)
|
||||
* [History.js](https://github.com/balupton/History.js/)
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js)
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/)
|
||||
* [jQuery.Globalize](https://github.com/jquery/globalize)
|
||||
* [jQuery](http://jquery.com/) (from TypeScript samples)
|
||||
* [jQuery Mobile](http://jquerymobile.com)
|
||||
* [jQuery UI](http://jqueryui.com/)
|
||||
* [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit))
|
||||
* [Knockout.js](http://knockoutjs.com/)
|
||||
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping)
|
||||
* [linq.js](http://linqjs.codeplex.com/) (by Marcin Najder (https://github.com/marcinnajder))
|
||||
* [Modernizr](http://modernizr.com/)
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
* [Mustache.js](https://github.com/janl/mustache.js)
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
* [node_redis](https://github.com/mranney/node_redis)
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver)
|
||||
* [PhoneGap](http://phonegap.com)
|
||||
* [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
|
||||
* [Sammy.js](http://sammyjs.org/)
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Spin](http://fgnass.github.com/spin.js/)
|
||||
* [Sugar](http://sugarjs.com/) (by Josh Baldwin)(https://github.com/jbaldwin/)
|
||||
* [Teechart](http://www.steema.com) (by [Steema]) (http://www.steema.com)
|
||||
* [Toastr](https://github.com/CodeSeven/toastr)
|
||||
* [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Underscore.js](http://underscorejs.org/)
|
||||
* [Underscore.js (Typed)](http://underscorejs.org/) (by Josh Baldwin)(https://github.com/jbaldwin/)
|
||||
|
||||
Next
|
||||
----
|
||||
* Facebook SDK
|
||||
* jQuery.Validate
|
||||
* google.visualization
|
||||
* Meteor
|
||||
* Isotope
|
||||
* Zepto
|
||||
* Socket.IO
|
||||
DefinitelyTyped
|
||||
===============
|
||||
|
||||
TypeScript type definitions repository for popular JavaScript libraries.
|
||||
|
||||
The project aims to provide *high quality* definitions for the most popular libraries out there.
|
||||
|
||||
Complete
|
||||
--------
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [async](https://github.com/caolan/async)
|
||||
* [Backbone.js](http://backbonejs.org/)
|
||||
* [Bootstrap](http://twitter.github.com/bootstrap/)
|
||||
* [CodeMirror](http://codemirror.net) (by [Franois de Campredon](https://github.com/fdecampredon))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/)
|
||||
* [dynatree](http://code.google.com/p/dynatree/) (by [Franois de Campredon](https://github.com/fdecampredon))
|
||||
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [ember.js](http://emberjs.com/)
|
||||
* [Express](http://expressjs.com/)
|
||||
* [Fancybox](http://fancybox.net/)
|
||||
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
|
||||
* [Handlebars](http://handlebarsjs.com/)
|
||||
* [History.js](https://github.com/balupton/History.js/)
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js)
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/)
|
||||
* [jQuery.Globalize](https://github.com/jquery/globalize)
|
||||
* [jQuery](http://jquery.com/) (from TypeScript samples)
|
||||
* [jQuery Mobile](http://jquerymobile.com)
|
||||
* [jQuery UI](http://jqueryui.com/)
|
||||
* [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit))
|
||||
* [Knockout.js](http://knockoutjs.com/)
|
||||
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping)
|
||||
* [linq.js](http://linqjs.codeplex.com/) (by Marcin Najder (https://github.com/marcinnajder))
|
||||
* [Modernizr](http://modernizr.com/)
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
* [Mustache.js](https://github.com/janl/mustache.js)
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
* [node_redis](https://github.com/mranney/node_redis)
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver)
|
||||
* [PhoneGap](http://phonegap.com)
|
||||
* [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
|
||||
* [Sammy.js](http://sammyjs.org/)
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Spin](http://fgnass.github.com/spin.js/)
|
||||
* [Sugar](http://sugarjs.com/) (by Josh Baldwin)(https://github.com/jbaldwin/)
|
||||
* [Teechart](http://www.steema.com) (by [Steema]) (http://www.steema.com)
|
||||
* [Toastr](https://github.com/CodeSeven/toastr)
|
||||
* [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Ubuntu Unity Web API](https://launchpad.net/libunity-webapps) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Underscore.js](http://underscorejs.org/)
|
||||
* [Underscore.js (Typed)](http://underscorejs.org/) (by Josh Baldwin)(https://github.com/jbaldwin/)
|
||||
|
||||
Next
|
||||
----
|
||||
* Facebook SDK
|
||||
* jQuery.Validate
|
||||
* google.visualization
|
||||
* Meteor
|
||||
* Isotope
|
||||
* Zepto
|
||||
* Socket.IO
|
||||
* MongoDB
|
||||
58
Tests/unity-webapi-tests.ts
Normal file
58
Tests/unity-webapi-tests.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/// <reference path="../Definitions/unity-webapi-1.0.d.ts" />
|
||||
|
||||
var Unity = external.getUnityObject(1.0);
|
||||
var settings = new UnitySettings();
|
||||
Unity.init(settings);
|
||||
|
||||
// Actions
|
||||
Unity.addAction("boom", function() {});
|
||||
Unity.removeAction("boom");
|
||||
Unity.removeActions();
|
||||
|
||||
// Notification
|
||||
Unity.Notification.showNotification("sum", "body");
|
||||
Unity.Notification.showNotification("sum", "body", "optional");
|
||||
|
||||
// Messaging
|
||||
var props = new UnityIndicatorProperties();
|
||||
props.count = 0;
|
||||
props.time = new Date();
|
||||
|
||||
Unity.MessagingIndicator.showIndicator("boom", props);
|
||||
Unity.MessagingIndicator.clearIndicator("boom");
|
||||
Unity.MessagingIndicator.clearIndicators();
|
||||
|
||||
Unity.MessagingIndicator.addAction("boom", function() {});
|
||||
Unity.MessagingIndicator.removeAction("boom");
|
||||
Unity.MessagingIndicator.removeActions();
|
||||
Unity.MessagingIndicator.onPresenceChanged(function() {});
|
||||
|
||||
// Launcher
|
||||
Unity.Launcher.setCount(1);
|
||||
Unity.Launcher.clearCount();
|
||||
|
||||
Unity.Launcher.setProgress(100);
|
||||
Unity.Launcher.clearProgress();
|
||||
|
||||
Unity.Launcher.setUrgent(true);
|
||||
|
||||
Unity.Launcher.addAction("boom", function(){});
|
||||
Unity.Launcher.removeAction("boom");
|
||||
Unity.Launcher.removeActions();
|
||||
|
||||
|
||||
// MediaPlayer
|
||||
var metadata = new UnityTrackMetadata();
|
||||
Unity.MediaPlayer.setTrack(metadata);
|
||||
|
||||
Unity.MediaPlayer.onPrevious(function(){});
|
||||
Unity.MediaPlayer.onNext(function(){});
|
||||
Unity.MediaPlayer.onPlayPause(function(){});
|
||||
|
||||
Unity.MediaPlayer.getPlaybackstate(function(){});
|
||||
Unity.MediaPlayer.setPlaybackstate(UnityPlaybackState.Playing);
|
||||
|
||||
Unity.MediaPlayer.setCanGoNext(true);
|
||||
Unity.MediaPlayer.setCanGoPrev(true);
|
||||
Unity.MediaPlayer.setCanPlay(true);
|
||||
Unity.MediaPlayer.setCanPause(true);
|
||||
Reference in New Issue
Block a user