Modular chrome extension for the game screeps.com.
In your Chrome browser go to Settings -> Extensions -> Load unpacked extension...
and select the Screeps-SC folder.
- Create a new javascript file under the
/modules
folder. - Add these functions to your javascript file:
module.exports.init = function(){...}
andmodule.exports.update = function(){...}
- Add your module to the
modules
array in thesettings.json
file.path
The path to your javascript file.runAt
Parameter when your module will run. It has two child parametersonUpdate
andonCompleted
onUpdate
The module will run when a screeps site has loaded a page that starts with the given value in this setting. For more information see google API for onUpdated.onCompleted
The module will run when any screeps webrequest is completed that starts with the given value in this setting. For more information see google API for onCompleted.
options
Not a required field. It is used to manage manual user configuration for the moduleimage
The path to an image to be displayed for the module in the settings pageconfig
Array with configuration elements for the settings page
- Reload the plugin at
Settings -> Extensions -> Screeps SC -> Reload
The project includes some modules I've created. Click on an image below to see the source code.
Also take a look at the settings.json to see the module configuration.
- On browser startup the extension will start listening on requests made to and from
*://screeps.com/*
. - When a url for a request starts with a given value in
onUpdate
oronCompleted
the background thread will execute the modulepath
connected to theonUpdate
oronCompleted
. - The
content.js
script will inject themodule.js
script together with the executed module. The executed module can access any function in themodule.js
script. Each module has their ownmodule.js
and it contains two module specific parametersmodule.name
andmodule.confg
(if you have set up a config in thesettings.json
). - If it's the first time the module is injected to the page session the
module.exports.init
function will be called in the module. All otheronUpdate
oronCompleted
triggers will call themodule.exports.update
function.