More hogfather structure.

This commit is contained in:
Ian Gulliver
2015-12-24 15:12:25 -08:00
parent 6e879ce1d5
commit b90d3d7b44
2 changed files with 22 additions and 9 deletions

View File

@@ -21,13 +21,22 @@
* @constructor
* @param {Cosmopolite} cosmo
* @param {string} name
* @param {function()} onReady
*/
var Hogfather = function(cosmo, name, onReady) {
cosmo.getProfile().then(function(profile_id) {
this.prefix_ = '/hogfather/' + profile_id + '/' + name + '/';
onReady();
}.bind(this));
var Hogfather = function(cosmo, name) {
this.cosmo_ = cosmo;
this.name_ = name;
this.cosmo_.getProfile().then(this.onProfile_.bind(this));
};
/**
* @param {string} profile_id
*/
Hogfather.prototype.onProfile_ = function(profile_id) {
this.prefix_ = '/hogfather/' + profile_id + '/' + this.name_ + '/';
this.cosmo_.subscribe(this.prefix_ + 'control');
console.log(this.prefix_);
};