Skip to content

Instantly share code, notes, and snippets.

@creesch
Created March 30, 2018 11:30
Show Gist options
  • Select an option

  • Save creesch/1e50205abc5f9cf767fd45cac6410510 to your computer and use it in GitHub Desktop.

Select an option

Save creesch/1e50205abc5f9cf767fd45cac6410510 to your computer and use it in GitHub Desktop.
function handleEvent(e) {
console.log(e);
}
const readyEvent = new CustomEvent('reddit.ready', {
detail: {
name: 'fakeConsumer'
}
});
document.addEventListener('reddit', handleEvent, true);
document.dispatchEvent(readyEvent);
{
"manifest_version": 2,
"name": "jsAPI",
"author": "toolbox team",
"short_name": "jsAPI",
"description": "jsAPI.",
"version": "1.0.0",
"applications": {
"gecko": {
"strict_min_version": "46.0"
}
},
"permissions": [
"https://*.reddit.com/",
"http://*.reddit.com/"
],
"content_scripts": [
{
"run_at": "document_end",
"matches": [
"http://*.reddit.com/*",
"https://*.reddit.com/*"
],
"js": [
"jsapi.js"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment