mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Move all packages to a types directory
This commit is contained in:
Vendored
+100
@@ -0,0 +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/DefinitelyTyped/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): any;
|
||||
|
||||
onPrevious(onPreviousCallback: Function): any;
|
||||
onNext(onNextCallback: Function): any;
|
||||
onPlayPause(onPlayPauseCallback: Function): any;
|
||||
|
||||
getPlaybackstate(response: Function): any;
|
||||
setPlaybackstate(state: UnityPlaybackState): any;
|
||||
|
||||
setCanGoNext(cangonext: boolean): any;
|
||||
setCanGoPrev(cangoprev: boolean): any;
|
||||
setCanPlay(canplay: boolean): any;
|
||||
setCanPause(canpause: boolean): any;
|
||||
}
|
||||
|
||||
interface UnityNotification {
|
||||
showNotification(summary: string, body: string, iconUrl?: string): any;
|
||||
}
|
||||
|
||||
declare class UnityIndicatorProperties {
|
||||
public count: number;
|
||||
public time: Date;
|
||||
public iconURI: string;
|
||||
public onIndicatorActivated: Function;
|
||||
}
|
||||
|
||||
interface UnityMessagingIndicator {
|
||||
showIndicator(name: string, indicatorProperties: UnityIndicatorProperties): any;
|
||||
clearIndicator(name: string): any;
|
||||
clearIndicators(): any;
|
||||
|
||||
addAction(name: string, onActionInvoked: Function): any;
|
||||
removeAction(name: string): any;
|
||||
removeActions(): any;
|
||||
onPresenceChanged(onPresenceChanged: Function): any;
|
||||
|
||||
// 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): any;
|
||||
clearCount(): any;
|
||||
|
||||
setProgress(progress: number): any;
|
||||
clearProgress(): any;
|
||||
|
||||
setUrgent(urgent: boolean): any;
|
||||
|
||||
addAction(name: string, onActionInvoked: Function): any;
|
||||
removeAction(name: string): any;
|
||||
removeActions(): any;
|
||||
}
|
||||
|
||||
interface Unity {
|
||||
init(settings: UnitySettings): any;
|
||||
addAction(name: string, callback: Function): any;
|
||||
removeAction(actionName: string): any;
|
||||
removeActions(): any;
|
||||
|
||||
Notification: UnityNotification;
|
||||
MediaPlayer: UnityMediaPlayer;
|
||||
MessagingIndicator: UnityMessagingIndicator;
|
||||
Launcher: UnityLauncher;
|
||||
}
|
||||
|
||||
interface BrowserPublic {
|
||||
getUnityObject(version: number): Unity;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"unity-webapi-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
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