sync: function() {
      var dfd = when.defer();
      var sendData = this.toJSON();

      cloak.message('trade', sendData);

      this.once('reject', function(receiveData) {
        if (!this.fuzzyMatch(receiveData)) {
          return;
        }
        dfd.reject();
      });
      this.once('accept', function(receiveData) {
        if (!this.fuzzyMatch(receiveData)) {
          return;
        }
        dfd.resolve();
      });

      return dfd.promise;
    }
Esempio n. 2
0
 begin: _.bind(function() {
   // Join cloak room for this group
   cloak.message('joinRoom', this.group);
 }, this)