FullScreen
Entity of FullScreen module is located in the global.WebModule.FullScreen.
If you want publish to global namespace.
FullScreen モジュールの実体は、global.WebModule.FullScreen にあります。
global 名前空間に直接公開する事もできます。その場合は global.FullScreen でもアクセス可能になります。
- FullScreen.enable はフルスクリーン機能が有効なら true になります
-
FullScreen.on(), FullScreen.off() で、
fullscreenchange
,fullscreenerror
イベントをハンドリングできます- FullScreen.once() は一度だけ有効な FullScreen.on です
- FullScreen.many() は指定した回数だけ有効な FullScreen.on です
- FullScreen.request(node) で指定した node をフルスクリーン表示します
- FullScreen.toggle(node) で指定した node のフルスクリーン表示状態を切り替えます
- FullScreen.exit() でフルスクリーン表示を終了します
- FullScreen.isActive() はフルスクリーン表示中に true になります
- FullScreen.getActiveNode() はフルスクリーン表示している node を返します
- FullScreen.release() は内部で抱えているリソースを解放します
FullScreen.enable:Boolean は、フルスクリーン機能が有効なら true になります。
if (FullScreen.enable) {
}
FullScreen.on(eventType:String, callback:Function):void は、 fullscreenchange
イベントまたは fullscreenerror
イベントをハンドリングする関数を登録します。
callbackは、 イベント発生のタイミングで、 callback(eventType:String, event:Event):void の形でコールバックします。
- callback は二重登録できません。既に登録されている場合は無視します
-
callback の第一引数(eventType) は、 W3C で規定されているイベント名
fullscreenchange
またはfullscreenerror
になります- 必要に応じて第二引数(event) からより詳細なイベント情報を取得できます
if (FullScreen.enable) {
FullScreen.on("fullscreenchange", _onfullscreenchange);
FullScreen.on("fullscreenerror", _onfullscreenerror);
}
function _onfullscreenchange(eventType, event) {
console.info(eventType); // "fullscreenchange"
}
function _onfullscreenerror(eventType, event) {
console.info(eventType); // "fullscreenerror"
}
FullScreen.once(eventType:String, callback:Function):void は、一度だけ有効な FullScreen.on です。
一度イベントが発生すると、自動的に FullScreen.off 相当の処理が行われます。
if (FullScreen.enable) {
FullScreen.once("fullscreenchange", function(eventType, event) {
console.info(eventType); // "fullscreenchange"
});
}
FullScreen.many(eventType:String, callback:Function, remain:UINT16):void は、 remain 回だけ有効な FullScreen.on です。
remain に指定した回数イベントが発生すると、自動的に FullScreen.off 相当の処理が行われます。
if (FullScreen.enable) {
FullScreen.many("fullscreenchange", function(eventType, event) {
console.info(eventType); // "fullscreenchange"
}, 3); // remain = 3
}
FullScreen.on(eventType:String, callback:Function):void は、 fullscreenchange
イベントまたは fullscreenerror
イベントをハンドリングする関数を登録します。
FullScreen.off(eventType:String, callback:Function):void は、登録済みのイベントをハンドリングする関数を削除します。
FullScreen.off("fullscreenchange", _onfullscreenchange);
FullScreen.off("fullscreenerror", _onfullscreenerror);
function _onfullscreenchange(eventType, event) {
console.info(eventType);
}
function _onfullscreenerror(eventType, event) {
console.info(eventType);
}
FullScreen.request(node:Node):Promise|null は指定した node をフルスクリーン表示にします。
- 最新の仕様に準拠したブラウザでは、戻り値が Promise になります
- ユーザの操作を起点にこの関数を呼ぶ必要があります
var content = document.querySelector("#content");
FullScreen.request(content);
FullScreen.toggle(node:Node):Promise|null は指定した node のフルスクリーン表示状態を切り替えます。
- 最新の仕様に準拠したブラウザでは、戻り値が Promise になります
- ユーザの操作を起点にこの関数を呼ぶ必要があります
var content = document.querySelector("#content");
FullScreen.toggle(content);
FullScreen.exit():Promise|null はフルスクリーン表示を終了します。
- 最新の仕様に準拠したブラウザでは、戻り値が Promise になります。
FullScreen.exit();
FullScreen.isActive():Boolean はフルスクリーン表示中に true になります。
if (FullScreen.isActive()) {
}
FullScreen.getActiveNode():Node はフルスクリーン表示している node を返します。
var node = FullScreen.getActiveNode(); // <div id="content">
FullScreen.release():void は、リソースを解放します。
- FullScreen.on と off で登録されている関数の登録を全て解除します
- FullScreen.enable を false にします
- FullScreen.release() 実行後は FullScreen.on() は機能しません
if (FullScreen.enable) {
FullScreen.release();
FullScreen.enable // -> false
}