[Common UI] Initial commonUI bundles
Bring in work on general-purpose and over-arching user interface bundles from the sandbox transition branch. WTD-574.
This commit is contained in:
41
platform/commonUI/browse/src/windowing/FullscreenAction.js
Normal file
41
platform/commonUI/browse/src/windowing/FullscreenAction.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/*global define,screenfull,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining FullscreenAction. Created by vwoeltje on 11/18/14.
|
||||
*/
|
||||
define(
|
||||
["../../lib/screenfull.min"],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var ENTER_FULLSCREEN = "Enter full screen mode.",
|
||||
EXIT_FULLSCREEN = "Exit full screen mode.";
|
||||
|
||||
/**
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function FullscreenAction(context) {
|
||||
return {
|
||||
perform: function () {
|
||||
screenfull.toggle();
|
||||
},
|
||||
getMetadata: function () {
|
||||
// We override getMetadata, because the glyph and
|
||||
// description need to be determined at run-time
|
||||
// based on whether or not we are currently
|
||||
// full screen.
|
||||
var metadata = Object.create(FullscreenAction);
|
||||
metadata.glyph = screenfull.isFullscreen ? "_" : "z";
|
||||
metadata.description = screenfull.isFullscreen ?
|
||||
EXIT_FULLSCREEN : ENTER_FULLSCREEN;
|
||||
metadata.group = "windowing";
|
||||
metadata.context = context;
|
||||
return metadata;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return FullscreenAction;
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user