79b9254c1a
Get the value for a single specific CSS Property from the modified element. returns can be specified either as a second parameter or an option.
13 lines
431 B
JavaScript
13 lines
431 B
JavaScript
import Modifier from 'ember-modifier';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class CSSPropModifier extends Modifier {
|
|
@service('-document') doc;
|
|
didReceiveArguments() {
|
|
const params = this.args.positional;
|
|
const options = this.args.named;
|
|
const returns = params[1] || options.returns;
|
|
returns(this.doc.defaultView.getComputedStyle(this.element).getPropertyValue(params[0]));
|
|
}
|
|
}
|