How to use the aurelia-binding.bindingBehavior function in aurelia-binding

To help you get started, we’ve selected a few aurelia-binding 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 / templating-resources / dist / es2015 / attr-binding-behavior.js View on Github external
var _dec, _class;

import { DataAttributeObserver, bindingBehavior } from 'aurelia-binding';

export let AttrBindingBehavior = (_dec = bindingBehavior('attr'), _dec(_class = class AttrBindingBehavior {
  bind(binding, source) {
    binding.targetObserver = new DataAttributeObserver(binding.target, binding.targetProperty);
  }

  unbind(binding, source) {}
}) || _class);
github aurelia / templating-resources / dist / native-modules / signal-binding-behavior.js View on Github external
var _dec, _class;



import { bindingBehavior } from 'aurelia-binding';
import { BindingSignaler } from './binding-signaler';

export var SignalBindingBehavior = (_dec = bindingBehavior('signal'), _dec(_class = function () {
  SignalBindingBehavior.inject = function inject() {
    return [BindingSignaler];
  };

  function SignalBindingBehavior(bindingSignaler) {
    

    this.signals = bindingSignaler.signals;
  }

  SignalBindingBehavior.prototype.bind = function bind(binding, source) {
    if (!binding.updateTarget) {
      throw new Error('Only property bindings and string interpolation bindings can be signaled.  Trigger, delegate and call bindings cannot be signaled.');
    }

    for (var _len = arguments.length, names = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
github aurelia / templating-resources / dist / es2015 / signal-binding-behavior.js View on Github external
var _dec, _class;

import { bindingBehavior } from 'aurelia-binding';
import { BindingSignaler } from './binding-signaler';

export let SignalBindingBehavior = (_dec = bindingBehavior('signal'), _dec(_class = class SignalBindingBehavior {
  static inject() {
    return [BindingSignaler];
  }


  constructor(bindingSignaler) {
    this.signals = bindingSignaler.signals;
  }

  bind(binding, source, ...names) {
    if (!binding.updateTarget) {
      throw new Error('Only property bindings and string interpolation bindings can be signaled.  Trigger, delegate and call bindings cannot be signaled.');
    }
    if (names.length === 1) {
      let name = names[0];
      let bindings = this.signals[name] || (this.signals[name] = []);
github aurelia / templating-resources / dist / native-modules / debounce-binding-behavior.js View on Github external
if (context !== state.callContextToDebounce) {
    state.oldValue = unset;
    this.debouncedMethod(context, newValue, oldValue);
    return;
  }
  if (state.oldValue === unset) {
    state.oldValue = oldValue;
  }
  state.timeoutId = setTimeout(function () {
    var _oldValue = state.oldValue;
    state.oldValue = unset;
    _this2.debouncedMethod(context, newValue, _oldValue);
  }, state.delay);
}

export var DebounceBindingBehavior = (_dec = bindingBehavior('debounce'), _dec(_class = function () {
  function DebounceBindingBehavior() {
    
  }

  DebounceBindingBehavior.prototype.bind = function bind(binding, source) {
    var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;

    var isCallSource = binding.callSource !== undefined;
    var methodToDebounce = isCallSource ? 'callSource' : 'call';
    var debouncer = isCallSource ? debounceCallSource : debounceCall;
    var mode = binding.mode;
    var callContextToDebounce = mode === bindingMode.twoWay || mode === bindingMode.fromView ? targetContext : sourceContext;

    binding.debouncedMethod = binding[methodToDebounce];
    binding.debouncedMethod.originalName = methodToDebounce;
github aurelia / templating-resources / dist / es2015 / debounce-binding-behavior.js View on Github external
if (context !== state.callContextToDebounce) {
    state.oldValue = unset;
    this.debouncedMethod(context, newValue, oldValue);
    return;
  }
  if (state.oldValue === unset) {
    state.oldValue = oldValue;
  }
  state.timeoutId = setTimeout(() => {
    const _oldValue = state.oldValue;
    state.oldValue = unset;
    this.debouncedMethod(context, newValue, _oldValue);
  }, state.delay);
}

export let DebounceBindingBehavior = (_dec = bindingBehavior('debounce'), _dec(_class = class DebounceBindingBehavior {
  bind(binding, source, delay = 200) {
    const isCallSource = binding.callSource !== undefined;
    const methodToDebounce = isCallSource ? 'callSource' : 'call';
    const debouncer = isCallSource ? debounceCallSource : debounceCall;
    const mode = binding.mode;
    const callContextToDebounce = mode === bindingMode.twoWay || mode === bindingMode.fromView ? targetContext : sourceContext;

    binding.debouncedMethod = binding[methodToDebounce];
    binding.debouncedMethod.originalName = methodToDebounce;

    binding[methodToDebounce] = debouncer;

    binding.debounceState = {
      callContextToDebounce,
      delay,
      timeoutId: 0,

aurelia-binding

A modern databinding library for JavaScript and HTML.

MIT
Latest version published 5 years ago

Package Health Score

56 / 100
Full package analysis