3.0.2 • Published 5 years ago

@beaker/core v3.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Beaker Core

Beaker browser's core software. Factored out so that we can build extensions from the same codebase.

Work in progress! Not ready to use.

Here's how we use it in electron (the browser):

import {app, protocol} from 'electron'
import beakerCore from '@beaker/core'

const DISALLOWED_SAVE_PATH_NAMES = [
  'home',
  'desktop',
  'documents',
  'downloads',
  'music',
  'pictures',
  'videos'
]

// setup beaker-core
await beakerCore.setup({
  // config
  userDataPath: app.getPath('userData'),
  homePath: app.getPath('home'),
  templatesPath: path.join(__dirname, 'assets', 'templates'),
  disallowedSavePaths: DISALLOWED_SAVE_PATH_NAMES.map(path => app.getPath(path)),

  // APIs
  permsAPI: {
    async checkLabsPerm({perm, labApi, apiDocsUrl, sender}) {/*...*/},
    async queryPermission(perm, sender) {/*...*/},
    async requestPermission(perm, sender) {/*...*/},
    async grantPermission(perm, senderURL) {/*...*/}
  },
  uiAPI: {
    async showModal(sender, modalName, opts) {/*...*/},
    async capturePage(url, opts) {/*...*/}
  },
  rpcAPI: {
    exportAPI(apiName, apiManifest, apiImpl, [guardFn])
  },
  downloadsWebAPI: {...},
  browserWebAPI: {...}
})

// setup the protocol handler
protocol.registerStreamProtocol('dat', beakerCore.dat.protocol.electronHandler, err => {
  if (err) throw ProtocolSetupError(err, 'Failed to create protocol: dat')
})

In the webview preload:

import beakerCoreWebview from '@beaker/core/webview'

beakerCoreWebview.setup({
  // APIs
  rpcAPI: {
    importAPI(apiName, apiManifest, opts)
  }
})

API (@beaker/core)

setup()

getEnvVar()

debugLogger(name)

import {debugLogger} from '@beaker/core'
const debug = debugLogger('dat')

// write to the debug log under 'dat'
debug('dat-related stuff')

getLogFilePath()

getLogFileContent(start, end)

globals

dbs

dbs.archives

dbs.bookmarks

dbs.history

dbs.settings

dbs.sitedata

dbs.templates

dat

dat.library

dat.dns

dat.folderSync

dat.garbageCollector

dat.protocol

dat.debug

API (@beaker/core/webview)

setup()

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.19.0

5 years ago

2.18.0

5 years ago

2.17.1

5 years ago

2.17.0

6 years ago

2.16.1

6 years ago

2.16.0

6 years ago

2.15.0

6 years ago

2.14.3

6 years ago

2.14.2

6 years ago

2.14.1

6 years ago

2.14.0

6 years ago

2.13.3

6 years ago

2.13.2

6 years ago

2.13.1

6 years ago

2.13.0

6 years ago

2.12.0

6 years ago

2.11.1

6 years ago

2.11.0

6 years ago

2.10.5

6 years ago

2.10.4

6 years ago

2.10.3

6 years ago

2.10.2

6 years ago

2.10.1

6 years ago

2.10.0

6 years ago

2.9.4

6 years ago

2.9.3

6 years ago

2.9.2

6 years ago

2.9.1

6 years ago

2.9.0

6 years ago

2.8.2

6 years ago

2.8.1

6 years ago

2.8.0

6 years ago

2.7.0

6 years ago

2.6.4

6 years ago

2.6.3

6 years ago

2.6.2

6 years ago

2.6.1

6 years ago

2.6.0

6 years ago

2.5.3

6 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago