Skip to content

Commit

Permalink
Avoid duplicate SDK in bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarrough committed Apr 28, 2024
1 parent 306418b commit b981e52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion examples/r4-tuner/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
frequencies. It will "snap" to the closest channel.
</p>
<p>You can access the selected channel on the property <code>selectedChannel</code>.</p>

<hr/>
<p>Default:</p>
<r4-tuner></r4-tuner>
<p>Set <code>showSource</code> attribute to render the list as well.</p>
<r4-tuner showSource></r4-tuner>
</body>
</html>
8 changes: 4 additions & 4 deletions src/components/r4-tuner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, html } from 'lit'
import { sdk } from '@radio4000/sdk'
import { sdk } from '../libs/sdk'

export default class R4Tuner extends LitElement {
static properties = {
Expand All @@ -23,8 +23,8 @@ export default class R4Tuner extends LitElement {
this.setChannels()
}

// Fetches all channels, adds a "frequency" property and sorts by it.
async setChannels() {
// Loads channels, sorts by slugs and adds a frequency property.
const { data: channels } = await sdk.channels.readChannels()

for (const c of channels) {
Expand Down Expand Up @@ -85,9 +85,9 @@ export default class R4Tuner extends LitElement {
}

/**
* Generate a unique frequency based on the channel name and slug.
* Generate a unique, deterministic frequency based on the channel name and slug.
* All frequency values are rounded to one decimal place.
* Values are deterministic. Values are generated inside a given range.
* Values are generated inside a given range.
* @param {string} channelName
* @param {string} channelSlug
* @param {number} minFreq - the minimum frequency
Expand Down

0 comments on commit b981e52

Please sign in to comment.