JavaScript on TV Building full screen apps with Vue.js Welcome to - - PowerPoint PPT Presentation

javascript on tv
SMART_READER_LITE
LIVE PREVIEW

JavaScript on TV Building full screen apps with Vue.js Welcome to - - PowerPoint PPT Presentation

JavaScript on TV Building full screen apps with Vue.js Welcome to multiplatform hell. Theres so many of them! LG Netcast LG WebOS Samsung Tizen Android TV Firefox OS (srsly.) Roku TV Fire TV tvOS and the


slide-1
SLIDE 1

JavaScript on TV

Building full screen apps with Vue.js

slide-2
SLIDE 2

Welcome to multiplatform hell.

slide-3
SLIDE 3

There’s so many of them!

  • LG Netcast
  • LG WebOS
  • Samsung Tizen
  • Android TV
  • Firefox OS (srsly.)
  • Roku TV
  • Fire TV
  • tvOS
  • … and the list goes on.
slide-4
SLIDE 4

webapp!

It’ll work everywhere.

slide-5
SLIDE 5

Welcome to multiplaform cross-browser hell.

slide-6
SLIDE 6

There’s still quite a lot of them!

  • Mostly WebKit forks
  • Mostly frozen in time
  • Some APIs missing
  • Some user agents are fake
  • Video support is hilarious
  • You look for matching desktop browsers
slide-7
SLIDE 7

How TV development looks

  • Fixed wrapper
  • Mashing on the keyboard
  • Surrounded by TVs
slide-8
SLIDE 8

Off to a good start with vue-cli

  • Webpack template
  • Dev environment (linters, HMR, error
  • verlay)
  • Production builds
  • Unit & E2E tests
  • A router
  • VueX had to be added
slide-9
SLIDE 9

New problems

slide-10
SLIDE 10

Section switching

  • Should I write a mini handler?
  • Doh, router!
  • Free transitions
slide-11
SLIDE 11

Navigation

  • Router saves the day again
  • Nested routes/partial templates
slide-12
SLIDE 12
slide-13
SLIDE 13

Global state

  • VueX is really helpful
  • App has a _lot_ of global state
  • Reactive programming greatly simplifies

this

slide-14
SLIDE 14

Optimising for performance

  • The TVs are slow
  • The browsers are even slower
  • We need to dig deep
  • Followed a container/component structure

from Redux

  • Dumb components are easy to modify
  • Architecture quality is not affected
slide-15
SLIDE 15

Remote control

  • By far the most interesting problem
  • Opposite flow of events affects

architecture

  • Constraints on what kind of states you can

have

  • Reactive programming, again, really helps
slide-16
SLIDE 16

The solution

Main event handler: if (specialCaseActive) { specialCaseHandler(); } else { regularHandlers[currentRoute]() } Mixin: export default { created() { regularHandlers[currentRoute] = this.handleKey; } } Each page component: export default { ... mixins: [registerkeyHandler], methods: { handleKey(key) { ... } }, ... }

slide-17
SLIDE 17

Final verdict: surprisingly applicable

slide-18
SLIDE 18

mato@zgajner.com, work done for united.cloud