mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-08 03:00:02 +00:00
Add jquery.fullscreen typings
This commit is contained in:
57
jquery.fullscreen/jquery.fullscreen.d.ts
vendored
Normal file
57
jquery.fullscreen/jquery.fullscreen.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Type definitions for jquery.fullscreen
|
||||
// Project: https://github.com/private-face/jquery.fullscreen
|
||||
// Definitions by: Piraveen Kamalathas <https://github.com/piraveen>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
/**
|
||||
* Extends jQuery interface
|
||||
* i.e: To use $elem.fullscreen()
|
||||
*/
|
||||
interface JQuery {
|
||||
fullscreen(options?: Object): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the jquery plugin
|
||||
*/
|
||||
interface JQueryFullscreen {
|
||||
/**
|
||||
* [open Activate fullscreen mode in a specific element through static method]
|
||||
* @param {Element} element [description]
|
||||
* @param {Object} options [description]
|
||||
*/
|
||||
open(element: Element, options?: Object): void;
|
||||
|
||||
/**
|
||||
* [close Deactivate fullscreen mode]
|
||||
* TODO: have to check for params
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
* [isFullScreen Get fullscreen status]
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
isFullScreen(): boolean;
|
||||
|
||||
/**
|
||||
* [isNativelySupported Check if fullscreen is supported by the browser]
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
isNativelySupported(): boolean;
|
||||
|
||||
/**
|
||||
* [exit Deactivate and destroy all fullscreen instances]
|
||||
*/
|
||||
exit(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends JqueryStatic ($)
|
||||
* i.e: To use $.fullscreen.functionName()
|
||||
*/
|
||||
interface JQueryStatic {
|
||||
fullscreen: JQueryFullscreen;
|
||||
}
|
||||
34
jquery.fullscreen/jquery.fullscreen.tests.ts
Normal file
34
jquery.fullscreen/jquery.fullscreen.tests.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/// <reference path="jquery.fullscreen.d.ts"/>
|
||||
|
||||
//
|
||||
// Examples from https://github.com/kayahr/jquery-fullscreen-plugin
|
||||
//
|
||||
|
||||
$(document).on('ready', () => {
|
||||
function checkBrowserSupport() {
|
||||
console.log("Native Browser support: ", $.fullscreen.isNativelySupported());
|
||||
}
|
||||
|
||||
function activateFullscreen() {
|
||||
$(document).fullscreen();
|
||||
}
|
||||
|
||||
function exitFullscreen() {
|
||||
$.fullscreen.exit();
|
||||
}
|
||||
|
||||
function fullscreenStatus() {
|
||||
var state = ($.fullscreen.isFullScreen()) ? 'is active' : 'is inactive' ;
|
||||
console.log("Fullscreen is %s", state);
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
checkBrowserSupport();
|
||||
activateFullscreen();
|
||||
fullscreenStatus();
|
||||
exitFullscreen();
|
||||
fullscreenStatus();
|
||||
}
|
||||
|
||||
runTests();
|
||||
});
|
||||
Reference in New Issue
Block a user