Skip to content

Instantly share code, notes, and snippets.

@coderaiser
Created June 4, 2014 11:00
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 coderaiser/09b89d382efd39267a38 to your computer and use it in GitHub Desktop.
Save coderaiser/09b89d382efd39267a38 to your computer and use it in GitHub Desktop.
this.setValue = function(value) {
getEditConfig(function(config) {
Util.exec.if(!config.collaboration, function() {
Ace.setValue(value);
ConfigView.afterShow();
}, setFirepad);
});
};
function setFirepad(callback) {
var files = [
'https://cdn.firebase.com/js/client/1.0.11/firebase.js',
CloudCmd.LIBDIRCLIENT + 'edit/firepad/firepad.js'
];
DOM.load.parallel(files, function() {
var firepadRef,
path = location.host + Info.path,
url = 'https://cloudcmd.firebaseio.com/';
Ace.setValue('');
path = Util.replaceStr(path, '.', '-');
firepadRef = new Firebase(url + path);
FirePad = Firepad.fromACE(firepadRef, Ace);
FirePad.on('ready', function() {
var isEmpty = FirePad.isHistoryEmpty();
if (isEmpty)
Util.exec(callback);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment