Browser extension to hide view-reducing screen junk from websites.
Browse Source

Set defaults for PageActionButton options

tags/v1.1.0
Gerben 6 years ago
parent
commit
e70a7b051e
2 changed files with 6 additions and 3 deletions
  1. +5
    -1
      src/PageActionButton.js
  2. +1
    -2
      src/background_script.js

+ 5
- 1
src/PageActionButton.js View File

@@ -27,7 +27,11 @@
import browser from 'webextension-polyfill'


export default function PageActionButton({ visible, icon, onClicked }) {
export default function PageActionButton({
visible = tab => true,
icon = tab => null,
onClicked = tab => {},
}) {
async function setIcon(tab) {
let iconSetting = await icon(tab)
if (typeof iconSetting === 'string' || iconSetting === null) {


+ 1
- 2
src/background_script.js View File

@@ -4,7 +4,6 @@ import PageActionButton from './PageActionButton'
import { toggleEnabled, isEnabled, onEnabledChange } from './perOrigin'

const pageActionButton = PageActionButton({
visible: tab => true,
icon: async tab => (await isEnabled(tab.url)) ? '/icon_enabled.svg' : '/icon_disabled.svg',
onClicked: async tab => toggleEnabled(tab.url)
onClicked: async tab => toggleEnabled(tab.url),
})

Loading…
Cancel
Save