import { assert } from '@ember/debug'; import Component from '@ember/component'; import { set, computed } from '@ember/object'; import hbs from 'htmlbars-inline-precompile'; export default Component.extend({ // passed from outside onChange: null, wrapResponse: true, ttl: '30m', wrapTTL: computed('wrapResponse', 'ttl', function () { const { wrapResponse, ttl } = this; return wrapResponse ? ttl : null; }), didRender() { this._super(...arguments); this.onChange(this.wrapTTL); }, init() { this._super(...arguments); assert('`onChange` handler is a required attr in `' + this.toString() + '`.', this.onChange); }, layout: hbs`