mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
Mole Game
This mole game is based on a YouTube tutorial in our Chrome Extensions series. Watch it here.
Overview
In the sample, moles periodically appear from pipes in the browser toolbar. You score points by clicking the icon before the mole disappears.
If enabled, a browser tab is closed if you miss one of the moles.
Implementation Notes
Each icon in the browser toolbar is a seperate extension. The extensions communicate using the chrome.runtime.sendMessage API and the chrome.runtime.onMessageExternal event.
To discover mole extensions, the controller extension uses the chrome.management API.
By default, the tab closing behavior is disabled. You can enable this by commenting out the line in mole/service-worker.js.
Running this extension
- Clone this repository.
- Make several copies of the
moledirectory. - Load the
controllerdirectory and all mole directories in Chrome as unpacked extensions. - Wait for a mole to appear!