Created
July 17, 2015 07:57
-
-
Save hokein/5684615543bf7718c2d7 to your computer and use it in GitHub Desktop.
Steam-overlay-bug
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Hello Greenworks</title> | |
<script src="main.js"></script> | |
</head> | |
<body> | |
<h1>Greenworks Test</h1> | |
NW.js version: <i><script>document.write(process.versions['node-webkit'])</script></i>.</br> | |
io.js version: <i><script>document.write(process.version)</script></i>.</br> | |
<div id="logs" style="width: 70%; border: 1px dashed #ccc; padding: 3px; margin-top:10px;"></div> | |
<canvas id="forceRefreshCanvas" width="1" height="1"></canvas> | |
</body> | |
</body> |
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 message = ''; | |
var greenworks = require('./greenworks'); | |
if (!greenworks.initAPI()) { | |
log('Greenworks inits error'); | |
} | |
function log(msg) { | |
message = message + msg + '<br>'; | |
document.getElementById('logs').innerHTML = message; | |
} | |
function testSteamAPI() { | |
greenworks.saveTextToFile('test_file.txt', 'test_content', | |
function() { log('Save text to file successfully'); }, | |
function(err) { log('Failed on saving text to file'); }); | |
greenworks.readTextFromFile('test_file.txt', function(message) { | |
log('Read text from file successfully.'); }, function(err) { | |
log('Failed on reading text from file'); }); | |
greenworks.getCloudQuota( | |
function() { log('Getting cloud quota successfully.') }, | |
function(err) { log('Failed on getting cloud quota.') }); | |
greenworks.activateAchievement('achievement', | |
function() { log('Activating achievement successfully'); }, | |
function(err) { log('Failed on activating achievement.'); }); | |
log('Cloud Enabled: ' + greenworks.isCloudEnabled()); | |
log('isGameOverlayEnabled: ' + greenworks.isGameOverlayEnabled()); | |
} | |
function forceRefresh() { | |
var canvas = document.getElementById("forceRefreshCanvas"); | |
var ctx = canvas.getContext("2d"); | |
ctx.clearRect(0, 0, canvas.width, canvas.height); | |
window.requestAnimationFrame(forceRefresh); | |
} | |
document.addEventListener('DOMContentLoaded', function() { | |
testSteamAPI(); | |
forceRefresh(); | |
}); |
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
{ | |
"name": "greenworks-nw-demo", | |
"main": "index.html" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment