Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/firebolt #40

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"vite": "^4.0.4"
},
"dependencies": {
"@lightningjs/blits": "^1.5.1"
"@lightningjs/blits": "^1.5.1",
"@firebolt-js/sdk": "^1.3.0"
}
}
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import Viewport from './pages/Viewport'
import { RouterHookRoutes } from './pages/RouterHooks.js'
import Resize from './pages/Resize'
import LanguagePlugin from './pages/LanguagePlugin.js'
import FireBoltPage from './pages/FireBolt'
import SourceInfo from './components/SourceInfo.js'

const queryString = new URLSearchParams(window.location.search)
Expand Down Expand Up @@ -124,6 +125,7 @@ export default Blits.Application({
...RouterHookRoutes,
{ path: '/examples/resize', component: Resize },
{ path: '/examples/languageplugin', component: LanguagePlugin },
{ path: '/examples/firebolt', component: FireBoltPage },
// Benchmarks and stress tests
{ path: '/benchmarks/exponential', component: Exponential },
],
Expand Down
95 changes: 95 additions & 0 deletions src/pages/FireBolt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright 2023 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 Blits from '@lightningjs/blits'

import { Lifecycle, Account, Device, Localization } from '@firebolt-js/sdk'

export default Blits.Component('Firebolt', {
template: `
<Element>
<Element :for="(fireboltApi, index) in $firebolt" x="$index * 250">
<Text
content="$fireboltApi"
x="80"
y="150"
wordwrap="180"
size="40"
align="center"
:color="$index === $activeIndex ?'#fff' : '#aaa'"
/>
</Element>
<Text x="960" y="540" mount="0.5" :content="$data" size="80" />
</Element>
`,
state() {
return {
activeIndex: -1,
size: 10,
data: 'Navigate Right and Left to see the results',
firebolt: ['Lifecycle', 'Audio', 'Make', 'Model', 'latlong'],
}
},
watch: {
activeIndex(v) {
if (v === 0) {
this.getLifeCycle()
} else if (v === 1) {
this.getAudio()
} else if (v === 2) {
this.getDeviceMake()
} else if (v === 3) {
this.getAccountId()
} else if (v === 4) {
this.getLatLon()
}
},
},
methods: {
getLifeCycle() {
this.data = 'LifeCycle state is ' + Lifecycle.state()
},
getAudio() {
Device.audio().then((supportedAudioProfiles) => {
this.data = 'DolbyAtmos ' + supportedAudioProfiles.dolbyAtmos
})
},
getDeviceMake() {
Device.make().then((make) => {
this.data = 'Device Make is ' + make
})
},
getLatLon() {
Localization.latlon().then((val) => {
this.data = `Lat value is ${val[0]}` + `, Lan value is ${val[1]}`
})
},
getAccountId() {
Account.id().then((id) => {
this.data = 'Account Id is' + id
})
},
},
input: {
right() {
this.activeIndex = Math.min(this.activeIndex + 1, this.firebolt.length - 1)
},
left() {
this.activeIndex = Math.max(this.activeIndex - 1, 0)
},
},
})
5 changes: 5 additions & 0 deletions src/pages/Portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ export default Blits.Component('Portal', {
id: 'examples/languageplugin',
description: 'Language Plugin for internationalization',
},
{
title: 'Firebolt Demo',
id: 'examples/firebolt',
description: 'Demo page to showcase Firebolt APIs',
},
],
benchmark: [
{
Expand Down