How to use aurelia-dependency-injection - 10 common examples

To help you get started, we’ve selected a few aurelia-dependency-injection examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / ux / packages / datepicker / src / ux-datepicker.ts View on Github external
import { customElement, bindable, ViewResources } from 'aurelia-templating';
import { bindingMode } from 'aurelia-binding';
import { inject } from 'aurelia-dependency-injection';
import { StyleEngine, UxComponent } from '@aurelia-ux/core';
import { DatetimeUtility } from './resources/datetime-utility';
import { DatepickerSettings } from './resources/datepicker-settings';
import { UxDatepickerTheme } from './ux-datepicker-theme';
import { moment } from './resources/moment-rexports';
// import UX_DATEPICKER_VIEW from './ux-datepicker.html';
// import { PLATFORM } from 'aurelia-pal';

@inject(Element, ViewResources, StyleEngine)
@customElement('ux-datepicker')
// @inlineView(
//   UX_DATEPICKER_VIEW,
//   [PLATFORM.moduleName('@aurelia-ux/datepicker/ux-datepicker.css')]
// )
export class UxDatepicker implements UxComponent {
  @bindable public theme: UxDatepickerTheme;

  @bindable public display = 'month';
  @bindable public type = 'datetime';
  @bindable public initialDate: any;
  @bindable public minTime: any;
  @bindable public maxTime: any;
  @bindable public minDate: any;
  @bindable public maxDate: any;
  @bindable public placeholder: any;
github SpoonX / aurelia-notification / src / notification.js View on Github external
* @decorator
 *
 * @see https://github.com/AvraamMavridis/javascript-decorators/
 */
function readonly() {
  return function(key, target, descriptor) {
    descriptor.writable = false;

    return descriptor;
  };
}

/**
 * The Notification class. Notify using humane-js with your custom names and defaults
 */
@inject(Config, Humane, I18N)
export class Notification {

  /**
     * Notify 'note' (translated if applicable) using humane.log.
     *
     * @param {string|string[]}  message|multi-line message.
     * @param {{}}               [options] for this particular notification.
     * @param {{}}               [defaults] for this type of notification.
     *
     */
  note(message, options = {}, defaults = this.__config.defaults) {} // eslint-disable-line  no-empty-function

  /**
     * Notify 'success' (translated if applicable) using humane.log.
     *
     * @param {string|string[]}  message|multi-line message.
github aurelia / templating / test / composition-engine.spec.js View on Github external
beforeEach(() => {
    container = new Container();
    compositionEngine = container.get(CompositionEngine);
  });
github buttonwoodcx / bcx-aurelia-reorderable-repeat / dist / es2015 / reorderable-repeat.js View on Github external
function addClass(el, className) {
    let current = el.className;
    if (!current.length) {
      el.className = className;
    } else if (!lookupClass(className).test(current)) {
      el.className += ' ' + className;
    }
  }

  function rmClass(el, className) {
    el.className = el.className.replace(lookupClass(className), ' ').trim();
  }
  return { add: addClass, rm: rmClass };
}();

export let ReorderableRepeat = (_dec = customAttribute('reorderable-repeat'), _dec2 = inject(EventAggregator, TaskQueue, BindingEngine, DndService, BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, ObserverLocator, ReorderableRepeatStrategyLocator), _dec(_class = templateController(_class = _dec2(_class = (_class2 = class ReorderableRepeat extends AbstractRepeater {
  constructor(ea, taskQueue, bindingEngine, dndService, viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {
    super({
      local: 'item',
      viewsRequireLifecycle: viewsRequireLifecycle(viewFactory)
    });

    _initDefineProp(this, 'items', _descriptor, this);

    _initDefineProp(this, 'local', _descriptor2, this);

    _initDefineProp(this, 'intention', _descriptor3, this);

    _initDefineProp(this, 'patchedItems', _descriptor4, this);

    this.type = 'reorder-' + seed;
    seed += 1;
github aurelia / templating-resources / dist / native-modules / repeat.js View on Github external
return desc;
}

function _initializerWarningHelper(descriptor, context) {
  throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

import { inject } from 'aurelia-dependency-injection';
import { ObserverLocator } from 'aurelia-binding';
import { BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, customAttribute, bindable, templateController } from 'aurelia-templating';
import { RepeatStrategyLocator } from './repeat-strategy-locator';
import { getItemsSourceExpression, unwrapExpression, isOneTime, updateOneTimeBinding } from './repeat-utilities';
import { viewsRequireLifecycle } from './analyze-view-factory';
import { AbstractRepeater } from './abstract-repeater';

export var Repeat = (_dec = customAttribute('repeat'), _dec2 = inject(BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, ObserverLocator, RepeatStrategyLocator), _dec(_class = templateController(_class = _dec2(_class = (_class2 = function (_AbstractRepeater) {
  _inherits(Repeat, _AbstractRepeater);

  function Repeat(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {
    

    var _this = _possibleConstructorReturn(this, _AbstractRepeater.call(this, {
      local: 'item',
      viewsRequireLifecycle: viewsRequireLifecycle(viewFactory)
    }));

    _initDefineProp(_this, 'items', _descriptor, _this);

    _initDefineProp(_this, 'local', _descriptor2, _this);

    _initDefineProp(_this, 'key', _descriptor3, _this);
github aurelia / templating-resources / dist / es2015 / repeat.js View on Github external
return desc;
}

function _initializerWarningHelper(descriptor, context) {
  throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

import { inject } from 'aurelia-dependency-injection';
import { ObserverLocator } from 'aurelia-binding';
import { BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, customAttribute, bindable, templateController } from 'aurelia-templating';
import { RepeatStrategyLocator } from './repeat-strategy-locator';
import { getItemsSourceExpression, unwrapExpression, isOneTime, updateOneTimeBinding } from './repeat-utilities';
import { viewsRequireLifecycle } from './analyze-view-factory';
import { AbstractRepeater } from './abstract-repeater';

export let Repeat = (_dec = customAttribute('repeat'), _dec2 = inject(BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, ObserverLocator, RepeatStrategyLocator), _dec(_class = templateController(_class = _dec2(_class = (_class2 = class Repeat extends AbstractRepeater {
  constructor(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {
    super({
      local: 'item',
      viewsRequireLifecycle: viewsRequireLifecycle(viewFactory)
    });

    _initDefineProp(this, 'items', _descriptor, this);

    _initDefineProp(this, 'local', _descriptor2, this);

    _initDefineProp(this, 'key', _descriptor3, this);

    _initDefineProp(this, 'value', _descriptor4, this);

    this.viewFactory = viewFactory;
    this.instruction = instruction;
github aurelia / ui-virtualization / dist / es2015 / virtual-repeat.js View on Github external
function _initializerWarningHelper(descriptor, context) {
  throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

import { inject } from 'aurelia-dependency-injection';
import { ObserverLocator } from 'aurelia-binding';
import { BoundViewFactory, ViewSlot, ViewResources, TargetInstruction, customAttribute, bindable, templateController, View } from 'aurelia-templating';
import { AbstractRepeater, getItemsSourceExpression, isOneTime, unwrapExpression, updateOneTimeBinding, viewsRequireLifecycle } from 'aurelia-templating-resources';
import { DOM } from 'aurelia-pal';
import { getStyleValue, calcOuterHeight, rebindAndMoveView } from './utilities';
import { DomHelper } from './dom-helper';
import { VirtualRepeatStrategyLocator } from './virtual-repeat-strategy-locator';
import { TemplateStrategyLocator } from './template-strategy';

export let VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = inject(DOM.Element, BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, ObserverLocator, VirtualRepeatStrategyLocator, TemplateStrategyLocator, DomHelper), _dec(_class = templateController(_class = _dec2(_class = (_class2 = class VirtualRepeat extends AbstractRepeater {
  constructor(element, viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator, templateStrategyLocator, domHelper) {
    super({
      local: 'item',
      viewsRequireLifecycle: viewsRequireLifecycle(viewFactory)
    });

    this._first = 0;
    this._previousFirst = 0;
    this._viewsLength = 0;
    this._lastRebind = 0;
    this._topBufferHeight = 0;
    this._bottomBufferHeight = 0;
    this._bufferSize = 5;
    this._scrollingDown = false;
    this._scrollingUp = false;
    this._switchedDirection = false;
github aurelia / ui-virtualization / dist / native-modules / virtual-repeat.js View on Github external
function _initializerWarningHelper(descriptor, context) {
  throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

import { inject } from 'aurelia-dependency-injection';
import { ObserverLocator } from 'aurelia-binding';
import { BoundViewFactory, ViewSlot, ViewResources, TargetInstruction, customAttribute, bindable, templateController, View } from 'aurelia-templating';
import { AbstractRepeater, getItemsSourceExpression, isOneTime, unwrapExpression, updateOneTimeBinding, viewsRequireLifecycle } from 'aurelia-templating-resources';
import { DOM } from 'aurelia-pal';
import { getStyleValue, calcOuterHeight, rebindAndMoveView } from './utilities';
import { DomHelper } from './dom-helper';
import { VirtualRepeatStrategyLocator } from './virtual-repeat-strategy-locator';
import { TemplateStrategyLocator } from './template-strategy';

export var VirtualRepeat = (_dec = customAttribute('virtual-repeat'), _dec2 = inject(DOM.Element, BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, ObserverLocator, VirtualRepeatStrategyLocator, TemplateStrategyLocator, DomHelper), _dec(_class = templateController(_class = _dec2(_class = (_class2 = function (_AbstractRepeater) {
  _inherits(VirtualRepeat, _AbstractRepeater);

  function VirtualRepeat(element, viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator, templateStrategyLocator, domHelper) {
    

    var _this = _possibleConstructorReturn(this, _AbstractRepeater.call(this, {
      local: 'item',
      viewsRequireLifecycle: viewsRequireLifecycle(viewFactory)
    }));

    _this._first = 0;
    _this._previousFirst = 0;
    _this._viewsLength = 0;
    _this._lastRebind = 0;
    _this._topBufferHeight = 0;
    _this._bottomBufferHeight = 0;
github aurelia / cli / spec / lib / workflow / input-text.spec.js View on Github external
beforeEach(() => {
    let Container = require('aurelia-dependency-injection').Container;
    let UI = require('../../../lib/ui').UI;
    let FakeUI = require('../../mocks/ui');
    let InputText = require('../../../lib/workflow/activities/input-text');
    let container = new Container();
    container.registerAlias(FakeUI, UI);
    ui = container.get(UI);
    sut = container.get(InputText);
  });

aurelia-dependency-injection

A lightweight, extensible dependency injection container for JavaScript.

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis