Skip to content

Instantly share code, notes, and snippets.

@oeddyo
Created February 19, 2014 19:50
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 oeddyo/9100165 to your computer and use it in GitHub Desktop.
Save oeddyo/9100165 to your computer and use it in GitHub Desktop.
getMachineID = function () {
var storedMacId = "";
chrome.storage.local.get('machine-id', function (item) {
storedMacId = item['machine-id'];
console.log("tmp id = " + storedMacId)
if (!storedMacId) {
console.log("before get " + storedMacId)
//storedMacId = getIdFromServer()
storedMacId = guid();
console.log("after get " + storedMacId)
chrome.storage.local.set({'machine-id': storedMacId});
}
console.log("id = " + storedMacId)
macId = storedMacId;
});
console.log("about to return "+storedMacId)
return storedMacId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment