open-consul/ui-v2/lib/block-slots/addon/mixins/slots.js
John Cowen 8483f0c27c
ui: Custom version of ember-block-slots compatible with ember 3 (#5245)
The original version of ember-block-slots doesn't support ember 3 and it
seems like development has stalled on the original version.

This adds a modified version as an in-repo-addon that is compatible with
ember 3.
2019-01-30 10:56:04 +00:00

18 lines
431 B
JavaScript

import { computed, get } from '@ember/object';
import { A } from '@ember/array';
import Mixin from '@ember/object/mixin';
export default Mixin.create({
_slots: computed(function() {
return A();
}),
_activateSlot(name) {
get(this, '_slots').addObject(name);
},
_deactivateSlot(name) {
get(this, '_slots').removeObject(name);
},
_isRegistered(name) {
return get(this, '_slots').includes(name);
},
});