Code Monkey home page Code Monkey logo

seventv-extension's Introduction

7TV Web Extension

Development

Building

  • make deps
  • make production

For a development/nightly (non-stable) build, set BRANCH=nightly in your environment variables.

Build output located in dist/.

Contributing

This extension is configured to work with HMR (Hot Module Replacement), which makes development significantly faster and more enjoyable than the traditional methods for making web extensions. This allows the developer to see changes reflect in real-time, even while on a remote website.

Working Locally

We use Vite as a primary tool for development and bundling.

Getting the extension to work locally is fast and easy, follow these steps:

  • Clone the repo: git clone [email protected]:SevenTV/Extension.git
  • Install dependencies: make deps
  • Run yarn start

The extension will now be compiled into its initial bundle, which may take up to twenty seconds. In dev mode, it is configured to connect to the vite server, which will start right after the bundle is complete.

The build files will be located in the dist/ folder: add this folder as an unpacked extension via the chrome extensions page.

Extension Loader

This repository is adapted as a BrowserExtension. It uses a manifest.json and the Extension API to run inside a browser.

The site-specific content and logic, however, runs as a Site Script, sectioned off by origin under src/sites. The Extension Content Script (src/content/content.ts) acts as a Loader for the site script, which is where the actual logic for modifying websites is located.

We do not use Isolated Worlds as we must access internal values from the website, which is not possible under an Extension Isolated World (content script).

Extension Background / Service Worker

The background script sets up some extension API-specific listeners for matters such as permissions. It also takes care of cross-site settings synchronization, by maintaining a copy of IndexedDB inside the Extension Context and re-distributing the updated config nodes to sites.

Site Script

Most of the logic inside the Extension runs under the Site Script, located under src/sites. Each folder there corresponds to an origin, such as twitch.tv or youtube.com. A module system exists to neatly section off features into their own space.

The site script works with HMR (Hot Module Replacement) and any changes to components within will hot-update accordingly, making UI building very efficient.

seventv-extension's People

Contributors

anatoleam avatar excellify avatar dependabot[bot] avatar melonify avatar matinaniss avatar 2547techno avatar berghall avatar therealgi avatar kelvinc6 avatar chipstm avatar lukashoracek avatar treuks avatar seabeya avatar zemycode avatar zklaurin avatar apricosma avatar godrums avatar psyclonetm avatar niller2005 avatar izedx avatar tautautautautau avatar ayyybubu avatar bl4d3tv avatar loczek avatar polyrtm avatar saliven avatar uriiusero 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.