Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 1x 1x 1x | import { A } from '@ember/array'; import { on } from '@ember/object/evented'; import EmberObject from '@ember/object'; /** * Allows multiple Note instances to be loaded up and played via their * `identifier`. * * @public * @class Font */ const Font = EmberObject.extend({ /** * Acts as a register for all the notes in the font. If null on instantiation, * set to `A()` via `_initNotes`. * * @public * @property notes * @type {Ember.MutableArray} */ notes: null, /** * Plays a note from `notes`, given it's `identifier`. * * @public * @method play * * @param {string} identifier The identifier for the note that should be * played. */ play(identifier) { this.getNote(identifier).play(); }, /** * Gets a note from `notes`, given it's identifier. * * @public * @method getNote * * @param {string} identifier The identifier for the note that should be * returned, * * @return {Note} The specified Note instance. */ getNote(identifier) { return this.get('notes').findBy('identifier', identifier); }, /** * Sets `notes` to `A()` if null on instantiation. * * @private * @method _initNotes */ _initNotes: on('init', function() { Eif (!this.get('notes')) { this.set('notes', A()); } }) }); export default Font; |