<div ref:_container></div>

<script>
import { Tracker } from 'meteor/tracker';

export default {
  onrender() {
    const { data, onrender } = this._options;

    this._instance = new this._component({
      target: this.refs._container
    });

    Tracker.nonreactive(() => {
      this._computation = Tracker.autorun(() => {
        data.call(null, this._instance);
      });
    });

    onrender && onrender(this._instance);
  },

  onteardown() {
    const { onteardown } = this._options;

    this._computation.stop();
    onteardown && onteardown(this._instance);
  }
};
</script>

<div ref:_container></div>

<script>
import { Tracker } from 'meteor/tracker';

export default {
  onrender() {
    const { data, onrender } = this._options;

    this._instance = new this._component({
      target: this.refs._container
    });

    // Create an empty context object that will be passed as `this` to each
    // user-defined function. This object can be used to store container state,
    // e.g., live query handles and timeout identifiers.
    this._context = Object.create(null);

    Tracker.nonreactive(() => {
      this._computation = Tracker.autorun(() => {
        data.call(this._context, this._instance);
      });
    });

    onrender && onrender.call(this._context, this._instance);
  },

  onteardown() {
    const { onteardown } = this._options;

    this._computation.stop();
    onteardown && onteardown.call(this._context, this._instance);
  }
};
</script>

Add context object for user-defined functions
Add context object for user-defined functions
