Created
June 19, 2015 00:28
-
-
Save sidorares/e82388f61e9345a7f760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test { | |
border: solid red 1px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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