@colyseus/schema 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4632,7 +4632,10 @@ function getDecoderStateCallbacks(decoder) {
4632
4632
  }
4633
4633
  },
4634
4634
  onRemove: function (callback) {
4635
- if (context.onInstanceAvailable) {
4635
+ if (context.instance) {
4636
+ return onRemove(context.instance, callback);
4637
+ }
4638
+ else if (context.onInstanceAvailable) {
4636
4639
  // collection instance not received yet
4637
4640
  let detachCallback = () => { };
4638
4641
  context.onInstanceAvailable((ref) => {
@@ -4640,12 +4643,12 @@ function getDecoderStateCallbacks(decoder) {
4640
4643
  });
4641
4644
  return () => detachCallback();
4642
4645
  }
4643
- else if (context.instance) {
4644
- return onRemove(context.instance, callback);
4645
- }
4646
4646
  },
4647
4647
  onChange: function (callback) {
4648
- if (context.onInstanceAvailable) {
4648
+ if (context.instance) {
4649
+ return onChange(context.instance, callback);
4650
+ }
4651
+ else if (context.onInstanceAvailable) {
4649
4652
  // collection instance not received yet
4650
4653
  let detachCallback = () => { };
4651
4654
  context.onInstanceAvailable((ref) => {
@@ -4653,9 +4656,6 @@ function getDecoderStateCallbacks(decoder) {
4653
4656
  });
4654
4657
  return () => detachCallback();
4655
4658
  }
4656
- else if (context.instance) {
4657
- return onChange(context.instance, callback);
4658
- }
4659
4659
  },
4660
4660
  }, {
4661
4661
  get(target, prop) {