Pop-a-loon Docs
GithubWebstores
  • Pop-a-loon documentation
  • Architecture
  • Adding a new balloon
  • architecture
    • Background
    • Content scripts
    • Popup
  • balloons
    • Confetti
    • Default
    • Fast
    • Ghost
    • Gold
Powered by GitBook
On this page
  • Table of Contents
  • Getting Started
  • Requirements
  • Installation
  • Development
  • Load the extension to chrome
  • Load the extension to firefox
  • Debugging in Visual Studio Code
  • Deployment
  • Adding a balloon
  • Architecture
  • Balloon spawn chances
  • Inheritance Tree
  • Abstract balloon class
Edit on GitHub

Pop-a-loon documentation

NextArchitecture

Last updated 7 months ago

Table of Contents

Getting Started

Requirements

Installation

Clone the repository:

git clone https://github.com/SimonStnn/pop-a-loon

Install the dependencies:

npm install

Development

Building for development can be done with the dev:{browser} script. Replace {browser} with the browser you want to build for. The available options are chrome and firefox.

dev:chrome

To build for Chrome:

npm run dev:chrome

This will build the extension in development mode for chrome. You can also include the --watch flag to automatically rebuild the extension when files change.

npm run dev:chrome -- --watch

dev:chrome:noremote

To build for Chrome without a remote :

npm run dev:chrome:noremote

This will build the extension in development mode for chrome without a remote server. You can also include the --watch flag to automatically rebuild the extension when files change.

npm run dev:chrome:noremote -- --watch

dev:chrome:remote

To build for Chrome with a remote server:

npm run dev:chrome:remote

dev:firefox

To build for Firefox:

npm run dev:firefox

This will build the extension in development mode for firefox. You can also include the --watch flag to automatically rebuild the extension when files change.

npm run dev:firefox -- --watch

dev:firefox:noremote

To build for Firefox without a remote :

npm run dev:firefox:noremote

This will build the extension in development mode for firefox without a remote server. You can also include the --watch flag to automatically rebuild the extension when files change.

npm run dev:firefox:noremote -- --watch

dev:firefox:remote

To build for Firefox with a remote server:

npm run dev:firefox:remote

This will build the extension in development mode for firefox with a remote server. You can also include the --watch flag to automatically rebuild the extension when files change.

npm run dev:firefox:remote -- --watch

Load the extension to chrome

The extension can be loaded in the browser by following the steps below:

  1. Don't forget to enable Developer mode in the top right corner.

  2. Click the Load unpacked button and select the dist/ directory.

  3. The extension should now be loaded and you can see the icon in the browser toolbar.

  4. Pin the extension to the toolbar for easy access.

Load the extension to firefox

The extension can be loaded in the browser by following the steps below:

  1. Click the Extensions tab on the left.

  2. Click the Manage your extensions button.

  3. Click the Debug Add-ons button.

  4. Click the Load Temporary Add-on button and select the manifest.json file in the dist/ directory.

  5. The extension should now be loaded and you can see the icon in the browser toolbar.

  6. Pin the extension to the toolbar for easy access.

Debugging in Visual Studio Code

  1. Open the project in Visual Studio Code.

  2. Go to the Run view (Ctrl+Shift+D).

  3. Select Launch Chrome or Launch Firefox from the dropdown at the top of the Run view.

  4. Press the Start Debugging button (F5).

This will start the development server (if it's not already running) and open a new browser instance with debugging enabled.

Deployment

To build the extension for production, use the build:{browser} script. Replace {browser} with the browser you want to build for. The available options are chrome and firefox. You can also include :zip to create a zip file of the extension.

build:chrome

To build for Chrome:

npm run build:chrome

build:chrome:zip

This will build the extension in production mode for chrome. You can also include the :zip flag to create a zip file of the extension.

npm run build:chrome:zip

The zip file will be created in the build/ directory.

build:firefox

To build for Firefox:

npm run build:firefox

build:firefox:zip

This will build the extension in production mode for firefox. You can also include the :zip flag to create a zip file of the extension.

npm run build:firefox:zip

build:all:zip

npm run build:all:zip

zip:source

This will create a zip file of the source code. The zip file will be created in the build/ directory with the name source-v{version}.zip.

npm run zip:source

The zip file will be created in the build/ directory.

Adding a balloon

Architecture

Balloon spawn chances

Inheritance Tree

Abstract balloon class

The abstract balloon class is the base class for all balloons.

The class serves as a base class for each balloon in pop-a-loon, providing essential functionality that must operate from this class.

[!IMPORTANT] The class has the following abstract properties and methods:

  • name: The name of the balloon. Should be the same as the name of the class, but in lowercase.

  • build(): Is called when the balloon should be built. In this method the class should for example add the styling and balloon image to the balloon element.

These properties and methods must be implemented in the child classes.

[!IMPORTANT] The element is the html element that will be added to the DOM after the balloon is built.

(>= v21.1.0)

(>= v10.3.0)

[!TIP] See the and sections for instructions on how to load the extension in the browser.

[!IMPORTANT] This will call the script.

[!IMPORTANT] This will connect to a server which is expected to be running on http://localhost:3000.

[!IMPORTANT] This will call the script.

[!IMPORTANT] This will connect to a server which is expected to be running on http://localhost:3000.

Open the Extension Management page by navigating to .

Open the Add-ons page by navigating to .

This will build the extension in production for all browsers and include a .

Refer to for instructions on how to add a new balloon to the extension.

[!NOTE] Read the document for a more detailed explanation of the architecture.

Node.js
npm
pop-a-loon-backend
pop-a-loon-backend
chrome://extensions
about:addons
adding a balloon
Architecture
Table of Contents
Getting Started
Requirements
Installation
Development
dev:chrome
dev:chrome:noremote
dev:chrome:remote
dev:firefox
dev:firefox:noremote
dev:firefox:remote
Load the extension to chrome
Load the extension to firefox
Debugging in Visual Studio Code
Deployment
build:chrome
build:chrome:zip
build:firefox
build:firefox:zip
build:all:zip
zip:source
Adding a balloon
Architecture
Balloon spawn chances
Inheritance Tree
Abstract balloon class
Balloons
Default balloon
Confetti balloon
Load the extension to chrome
Load the extension to firefox
dev:chrome:noremote
dev:firefox:noremote
zip file of the source code