@firebolt-js/manage-sdk
Version:
The Firebolt Manage JS SDK
424 lines (371 loc) • 9.2 kB
JavaScript
/*
* Copyright 2021 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
import Transport from '../Transport/index.mjs'
import Events from '../Events/index.mjs'
import { registerEvents } from '../Events/index.mjs'
import Prop from '../Prop/index.mjs'
registerEvents('ClosedCaptions', [
'backgroundColorChanged',
'backgroundOpacityChanged',
'enabledChanged',
'fontColorChanged',
'fontEdgeChanged',
'fontEdgeColorChanged',
'fontFamilyChanged',
'fontOpacityChanged',
'fontSizeChanged',
'preferredLanguagesChanged',
'textAlignChanged',
'textAlignVerticalChanged',
'windowColorChanged',
'windowOpacityChanged',
])
// onBackgroundColorChanged is accessed via listen('backgroundColorChanged, ...)
// onBackgroundOpacityChanged is accessed via listen('backgroundOpacityChanged, ...)
// onEnabledChanged is accessed via listen('enabledChanged, ...)
// onFontColorChanged is accessed via listen('fontColorChanged, ...)
// onFontEdgeChanged is accessed via listen('fontEdgeChanged, ...)
// onFontEdgeColorChanged is accessed via listen('fontEdgeColorChanged, ...)
// onFontFamilyChanged is accessed via listen('fontFamilyChanged, ...)
// onFontOpacityChanged is accessed via listen('fontOpacityChanged, ...)
// onFontSizeChanged is accessed via listen('fontSizeChanged, ...)
// onPreferredLanguagesChanged is accessed via listen('preferredLanguagesChanged, ...)
// onTextAlignChanged is accessed via listen('textAlignChanged, ...)
// onTextAlignVerticalChanged is accessed via listen('textAlignVerticalChanged, ...)
// onWindowColorChanged is accessed via listen('windowColorChanged, ...)
// onWindowOpacityChanged is accessed via listen('windowOpacityChanged, ...)
// Methods
function backgroundColor() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'backgroundColor',
params,
callbackOrValue,
false,
false,
0,
)
}
function backgroundOpacity() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'backgroundOpacity',
params,
callbackOrValue,
false,
false,
0,
)
}
function clear(...args) {
return Events.clear('ClosedCaptions', ...args)
}
function enabled() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'enabled',
params,
callbackOrValue,
false,
false,
0,
)
}
function fontColor() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'fontColor',
params,
callbackOrValue,
false,
false,
0,
)
}
function fontEdge() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'fontEdge',
params,
callbackOrValue,
false,
false,
0,
)
}
function fontEdgeColor() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'fontEdgeColor',
params,
callbackOrValue,
false,
false,
0,
)
}
function fontFamily() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'fontFamily',
params,
callbackOrValue,
false,
false,
0,
)
}
function fontOpacity() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'fontOpacity',
params,
callbackOrValue,
false,
false,
0,
)
}
function fontSize() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'fontSize',
params,
callbackOrValue,
false,
false,
0,
)
}
function listen(...args) {
return Events.listen('ClosedCaptions', ...args)
}
function once(...args) {
return Events.once('ClosedCaptions', ...args)
}
function preferredLanguages() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'preferredLanguages',
params,
callbackOrValue,
false,
false,
0,
)
}
function textAlign() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'textAlign',
params,
callbackOrValue,
false,
false,
0,
)
}
function textAlignVertical() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'textAlignVertical',
params,
callbackOrValue,
false,
false,
0,
)
}
function windowColor() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'windowColor',
params,
callbackOrValue,
false,
false,
0,
)
}
function windowOpacity() {
let callbackOrValue = arguments[0]
let params = {}
// x-subscriber-type: global
if (arguments.length === 1 && typeof arguments[0] === 'function') {
callbackOrValue = arguments[0]
params = {}
}
return Prop.prop(
'ClosedCaptions',
'windowOpacity',
params,
callbackOrValue,
false,
false,
0,
)
}
export default {
Events: {
ENABLED_CHANGED: 'enabledChanged',
FONT_FAMILY_CHANGED: 'fontFamilyChanged',
FONT_SIZE_CHANGED: 'fontSizeChanged',
FONT_COLOR_CHANGED: 'fontColorChanged',
FONT_EDGE_CHANGED: 'fontEdgeChanged',
FONT_EDGE_COLOR_CHANGED: 'fontEdgeColorChanged',
FONT_OPACITY_CHANGED: 'fontOpacityChanged',
BACKGROUND_COLOR_CHANGED: 'backgroundColorChanged',
BACKGROUND_OPACITY_CHANGED: 'backgroundOpacityChanged',
TEXT_ALIGN_CHANGED: 'textAlignChanged',
TEXT_ALIGN_VERTICAL_CHANGED: 'textAlignVerticalChanged',
WINDOW_COLOR_CHANGED: 'windowColorChanged',
WINDOW_OPACITY_CHANGED: 'windowOpacityChanged',
PREFERRED_LANGUAGES_CHANGED: 'preferredLanguagesChanged',
},
/**
*
*/
FontFamily: {
MONOSPACED_SERIF: 'monospaced_serif',
PROPORTIONAL_SERIF: 'proportional_serif',
MONOSPACED_SANSERIF: 'monospaced_sanserif',
PROPORTIONAL_SANSERIF: 'proportional_sanserif',
SMALLCAPS: 'smallcaps',
CURSIVE: 'cursive',
CASUAL: 'casual',
},
/**
*
*/
FontEdge: {
NONE: 'none',
RAISED: 'raised',
DEPRESSED: 'depressed',
UNIFORM: 'uniform',
DROP_SHADOW_LEFT: 'drop_shadow_left',
DROP_SHADOW_RIGHT: 'drop_shadow_right',
},
backgroundColor,
backgroundOpacity,
clear,
enabled,
fontColor,
fontEdge,
fontEdgeColor,
fontFamily,
fontOpacity,
fontSize,
listen,
once,
preferredLanguages,
textAlign,
textAlignVertical,
windowColor,
windowOpacity,
}