Skip to content

Latest commit

 

History

History
84 lines (64 loc) · 1.9 KB

File metadata and controls

84 lines (64 loc) · 1.9 KB

this-jquery

Usage

npx ember-component-jquery this-jquery path/of/files/ or/some**/*glob.js

# or

yarn global add ember-component-jquery
ember-component-jquery this-jquery path/of/files/ or/some**/*glob.js

Input / Output


with-import

Input (with-import.input.js):

import $ from 'jquery';
import Component from '@ember/component';

export default Component.extend({
  didInsertElement() {
    $(window).on('load', () => console.log('loaded'));
    this.$().css('background', 'red');
    this.$('input').focus();
  },
});

Output (with-import.output.js):

import $ from 'jquery';
import Component from '@ember/component';

export default Component.extend({
  didInsertElement() {
    $(window).on('load', () => console.log('loaded'));
    $(this.element).css('background', 'red');
    $('input', this.element).focus();
  },
});

without-import

Input (without-import.input.js):

import Component from '@ember/component';

export default Component.extend({
  didInsertElement() {
    this.$().css('background', 'red');
    this.$('input').focus();
  },
});

Output (without-import.output.js):

import $ from 'jquery';
import Component from '@ember/component';

export default Component.extend({
  didInsertElement() {
    $(this.element).css('background', 'red');
    $('input', this.element).focus();
  },
});