Skip to content

Instantly share code, notes, and snippets.

@epitron
Created October 17, 2014 18:38
Show Gist options
  • Save epitron/6fb17c32bbc1c714c420 to your computer and use it in GitHub Desktop.
Save epitron/6fb17c32bbc1c714c420 to your computer and use it in GitHub Desktop.
Sample Chrome Extension
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.commands.onCommand.addListener(function(command) {
console.log('onCommand event received for message: ', command);
});
This is a sample browser action popup.
{
"name": "Sample Extension Commands extension",
"description": "Press Ctrl+Shift+F (Command+Shift+F on a Mac) to open the browser action popup, press Ctrl+Shift+Y to send an event (Command+Shift+Y on a Mac).",
"version": "1.0",
"manifest_version": 2,
"background": {
"scripts": ["background.js"],
"persistent": false
},
"browser_action": {
"default_popup": "browser_action.html"
},
"commands": {
"toggle-feature": {
"suggested_key": { "default": "Ctrl+Shift+Y" },
"description": "Send a 'toggle-feature' event to the extension"
},
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+F",
"mac": "MacCtrl+Shift+F"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment