Skip to content

Instantly share code, notes, and snippets.

@sidorares
Created June 19, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidorares/e82388f61e9345a7f760 to your computer and use it in GitHub Desktop.
Save sidorares/e82388f61e9345a7f760 to your computer and use it in GitHub Desktop.
var Chrome = require('chrome-remote-interface');
var chooseTab = function(tabs) {
return 0;
};
Chrome({ chooseTab: chooseTab }, function(chrome) {
var CSS = chrome.CSS;
CSS.styleSheetAdded(function() {
console.log('added');
console.log(arguments);
});
CSS.styleSheetRemoved(function() {
console.log('removed');
console.log(arguments);
});
CSS.styleSheetChanged(function() {
console.log('changed');
console.log(arguments);
});
CSS.enable(function() {
console.log('CSS enabled');
});
});
#test {
border: solid red 1px;
}
var inserted = false;
var i = 0;
function foo() {
i++;
//if (!inserted) {
//inserted = true;
var s = document.createElement('style');
s.type = 'text/css';
s.innerText = 'body { background: #' + i + '; }';
document.head.appendChild(s);
//}
return "=test=" + Date.now();
}
setInterval(function() {
document.getElementById('test').innerText = foo();
}, 1000);
<html>
<head>
<link rel="stylesheet" type="text/css" href="test-live.css" />
<script src="test-live.js"></script>
</head>
<body>
<div id="test"> here </div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment