Merge pull request #22 from cphyc/bugfix-21

Bugfix 21
This commit is contained in:
Kevin Jahns 2015-05-21 14:51:48 +02:00
commit a9c2ec6ba0
8 changed files with 293 additions and 183 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -118,7 +118,7 @@ module.exports = {
} }
}, },
whenSynced: function(args) { whenSynced: function(args) {
if (args.constructore === Function) { if (args.constructor === Function) {
args = [args]; args = [args];
} }
if (this.is_synced) { if (this.is_synced) {
@ -205,14 +205,16 @@ module.exports = {
}); });
}, },
setStateSynced: function() { setStateSynced: function() {
var f, i, len, ref; var args, el, f, i, len, ref;
if (!this.is_synced) { if (!this.is_synced) {
this.is_synced = true; this.is_synced = true;
if (this.compute_when_synced != null) { if (this.compute_when_synced != null) {
ref = this.compute_when_synced; ref = this.compute_when_synced;
for (i = 0, len = ref.length; i < len; i++) { for (i = 0, len = ref.length; i < len; i++) {
f = ref[i]; el = ref[i];
f(); f = el[0];
args = el.slice(1);
f.apply(args);
} }
delete this.compute_when_synced; delete this.compute_when_synced;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -105,7 +105,7 @@ module.exports =
# @param f {Function} Will be executed on the PeerJs-Connector context. # @param f {Function} Will be executed on the PeerJs-Connector context.
# #
whenSynced: (args)-> whenSynced: (args)->
if args.constructore is Function if args.constructor is Function
args = [args] args = [args]
if @is_synced if @is_synced
args[0].apply this, args[1..] args[0].apply this, args[1..]
@ -192,8 +192,10 @@ module.exports =
if not @is_synced if not @is_synced
@is_synced = true @is_synced = true
if @compute_when_synced? if @compute_when_synced?
for f in @compute_when_synced for el in @compute_when_synced
f() f = el[0]
args = el[1..]
f.apply(args)
delete @compute_when_synced delete @compute_when_synced
null null

2
y.js

File diff suppressed because one or more lines are too long