GithubHelp home page GithubHelp logo

knownasilya / beaker-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beakerbrowser/beaker-core

0.0 3.0 0.0 1.83 MB

Beaker browser's core software

License: MIT License

JavaScript 100.00%

beaker-core's Introduction

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()

beaker-core's People

Contributors

pfrazee avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.