Replace chrome.extension with chrome.runtime

The messaging APIs in `extension` module are deprecated in favor of
the equivalent APIs in the `runtime` module.

Sources:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/extension
https://developer.chrome.com/extensions/extension#methods
This commit is contained in:
codebicycle
2017-10-03 19:14:37 +03:00
committed by Ilya Grigorik
parent 194fcc1076
commit ae778d2901
2 changed files with 4 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
chrome.extension.sendMessage({}, function(response) { chrome.runtime.sendMessage({}, function(response) {
var tc = { var tc = {
settings: { settings: {
speed: 1.0, // default 1x speed: 1.0, // default 1x
@@ -117,7 +117,7 @@ chrome.extension.sendMessage({}, function(response) {
var shadow = wrapper.createShadowRoot(); var shadow = wrapper.createShadowRoot();
var shadowTemplate = ` var shadowTemplate = `
<style> <style>
@import "${chrome.extension.getURL('shadow.css')}"; @import "${chrome.runtime.getURL('shadow.css')}";
</style> </style>
<div id="controller" style="top:${top}; left:${left}"> <div id="controller" style="top:${top}; left:${left}">
@@ -213,7 +213,7 @@ chrome.extension.sendMessage({}, function(response) {
defineVideoController(); defineVideoController();
} else { } else {
var link = document.createElement('link'); var link = document.createElement('link');
link.href = chrome.extension.getURL('inject.css'); link.href = chrome.runtime.getURL('inject.css');
link.type = 'text/css'; link.type = 'text/css';
link.rel = 'stylesheet'; link.rel = 'stylesheet';
document.head.appendChild(link); document.head.appendChild(link);

View File

@@ -1,6 +1,6 @@
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#config').addEventListener('click', function() { document.querySelector('#config').addEventListener('click', function() {
window.open(chrome.extension.getURL("options.html")); window.open(chrome.runtime.getURL("options.html"));
}); });
document.querySelector('#about').addEventListener('click', function() { document.querySelector('#about').addEventListener('click', function() {