在JS中传递对象之间的数组

时间:2016-02-18 11:11:01

标签: javascript

我正在学习JS并遇到了将数组从一个类传递到另一个类的问题。假设我有两个类,一个绘制曲线,另一个绘制FT,如下所示:

Tangle.classes.RFPulse = {

  initialize: function(el,options,tangle) {
    this.tangle = tangle;
    this.RFSincShape = [];
  },
  update: function(el, pulseDuration) {
    ....
    for (x=0; x < canvasWidth; x++) {
    this.RFSincShape[x] = x;
  },
  getSincCurve: function() {
    return this.RFSincShape; // Something wrong here?
  }
}

Tangle.classes.RFPulseFT = {

  initialize: function (el,options,tangle) {
     this.tangle = tangle;
     // or something wrong here?
     this.SliceShape = Tangle.classes.RFPulse.getSincCurve();
  },

  update: function (el,c_timeBandwidthProduct, c_pulseDuration) {
     // or here?
     this.SliceShape = Tangle.classes.RFPulse.getSincCurve();
     ... FFT of this.SliceShape...
  }
}

为什么我无法检索RFSincShape?我怎么能解决这个问题,这些问题的优良做法是什么?

0 个答案:

没有答案