Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const event = keys.reduce((event, attribute) => {
const isValidModifier = validModifiers.indexOf(attribute) > -1;
if (isValidModifier) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
const keyCode = getKeyCode(attribute);
event.code = attribute;
// deprecated / removed from the Web Standards
event.which = keyCode;
event.keyCode = keyCode;
}
return event;
}, {});
const event = keys.reduce((event, attribute) => {
const isValidModifier = validModifiers.indexOf(attribute) > -1;
if (isValidModifier) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
const keyCode = getKeyCode(attribute);
event.code = attribute;
// deprecated / removed from the Web Standards
event.which = keyCode;
event.keyCode = keyCode;
}
return event;
}, {});
const event = keys.reduce((event, attribute) => {
const isValidModifier = validModifiers.indexOf(attribute) > -1;
if (isValidModifier) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
const keyCode = getKeyCode(attribute);
event.code = attribute;
// deprecated / removed from the Web Standards
event.which = keyCode;
event.keyCode = keyCode;
}
const event = keys.reduce((event, attribute) => {
const isValidModifier = validModifiers.indexOf(attribute) > -1;
if (isValidModifier) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
const keyCode = getKeyCode(attribute);
event.code = attribute;
// deprecated / removed from the Web Standards
event.which = keyCode;
event.keyCode = keyCode;
}
return event;
}, {});
const event = keys.reduce((event, attribute) => {
const isValidModifier = validModifiers.indexOf(attribute) > -1;
if (isValidModifier) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
const keyCode = getKeyCode(attribute);
event.code = attribute;
// deprecated / removed from the Web Standards
event.which = keyCode;
event.keyCode = keyCode;
}
return event;
}, {});
// optional params
selectedTransition: null,
selectedClip: null,
// params
selectedQuantizations: [BAR_QUANTIZATION],
selectedQuantization: Ember.computed.reads('selectedQuantizations.firstObject'),
mixVisualActionReceiver: null,
store: Ember.inject.service(),
followPlayhead: false,
selectedAutomation: CONTROL_TYPE_VOLUME,
newTrackPosition: null,
_playpauseMix: Ember.on(keyDown('Space'), makeKeybinding(function(e) {
this.send('playpause');
})),
_exitTransitionOnEscape: Ember.on(keyDown('Escape'), makeKeybinding(function(e) {
this.send('selectTransition', null);
})),
_pauseMix: Ember.on('willDestroyElement', function() {
this.send('pause');
}),
// repeatedely save mix, if any unsaved changes
// _autoSaveMix: Ember.on('init', function() {
// if (!this.get('isDestroyed')) {
// const mix = this.get('mix');
})
// Add a reference to the Ember Data model to each API item search result
.map(searchResult => {
let { document } = searchResult;
if (document.type !== 'template') {
let store = this.get('store');
searchResult.model = store.peekRecord(document.type, document.item.id)
}
return searchResult;
});
}
}),
gotoSelectedItem: on(keyUp('Enter'), function() {
if (this.get('selectedIndex') !== null) {
let selectedResult = this.get('searchResults')[this.get('selectedIndex')];
if (selectedResult.document.type === 'template') {
this.get('router').transitionTo(selectedResult.document.route);
} else {
this.get('router').transitionTo('docs.api.item', selectedResult.model.get('routingId'));
}
}
this.get('on-visit')();
}),
nextSearchResult: on(keyDown('ctrl+KeyN'), keyDown('ArrowDown'), function() {
let hasSearchResults = this.get('searchResults.length');
let lastResultIsSelected = (this.get('selectedIndex') + 1 === this.get('searchResults.length'));
didInsertElement() {
this._super();
this.get('fetchProject').perform();
},
// TODO: The searchbox doesn't work without the project being fetched.
// We should move this logic (and everywhere else in the code that's fetching
// the project) within a new addonDocs service that wires all that up together.
// I think it's fine if our Docs-* components assume there is a single global
// project.
fetchProject: task(function*() {
yield this.get('store').findRecord('project', projectName);
}),
focusSearch: on(keyUp('Slash'), function() {
if (!formElementHasFocus()) {
this.element.querySelector('input').focus();
}
}),
unfocusSearch: on(keyUp('Escape'), function() {
this.get('on-input')(null);
})
});
const event = (attributes || '').split('+').reduce((event, attribute) => {
if (validModifiers.indexOf(attribute) > -1) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
event.keyCode = getKeyCode(attribute);
}
return event;
}, {});
const event = (attributes || '').split('+').reduce((event, attribute) => {
if (validModifiers.indexOf(attribute) > -1) {
attribute = attribute === 'cmd' ? getCmdKey() : attribute;
event[`${attribute}Key`] = true;
} else if (validMouseButtons.indexOf(attribute) > -1) {
event.button = getMouseCode(attribute);
} else {
event.keyCode = getKeyCode(attribute);
}
return event;
}, {});