Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

Commit

Permalink
issue #14: Proposal: Implementing a grain name sync event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
synchrone committed Mar 3, 2016
1 parent 8bf7b7e commit b0e2c68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions infcloud/sandstorm-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,19 @@ $(function(){
btn.appendTo('.integration_d');
}

function setupGrainNameUpdater(){
window.addEventListener("message", function(event) {
if(event.data.rpcId == 'sandstorm#grainNameUpdate' && event.data.grainName) {
var safeName = event.data.grainName.replace().trim() || 'Unnamed Grain';
netSaveProperty($.extend({url: ''}, globalAccountSettings[0]), 'DAV:', 'displayname', safeName);
}
});
window.parent.postMessage({subscribeToGrainNameUpdates:true}, "*");
}

setupSync();
setupImport();
setupGrainNameUpdater();
});

//disable Backspace navigate back, which behaves poorly inside Sandstorm's iframe
Expand Down

0 comments on commit b0e2c68

Please sign in to comment.