Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (binding.mode !== bindingMode.twoWay && binding.mode !== bindingMode.fromView) {
throw new Error(notApplicableMessage);
}
// ensure the binding's target observer has been set.
let targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
if (!targetObserver.handler) {
throw new Error(notApplicableMessage);
}
binding.targetObserver = targetObserver;
// stash the original element subscribe function.
targetObserver.originalHandler = binding.targetObserver.handler;
// replace the element subscribe function with one that uses the correct events.
let handler = new EventSubscriber(events);
targetObserver.handler = handler;
}
if (binding.mode !== bindingMode.twoWay && binding.mode !== bindingMode.fromView) {
throw new Error(notApplicableMessage);
}
// ensure the binding's target observer has been set.
let targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
if (!targetObserver.handler) {
throw new Error(notApplicableMessage);
}
binding.targetObserver = targetObserver;
// stash the original element subscribe function.
targetObserver.originalHandler = binding.targetObserver.handler;
// replace the element subscribe function with one that uses the correct events.
let handler = new EventSubscriber(events);
targetObserver.handler = handler;
}
bind(binding, source, ...events) {
if (events.length === 0) {
throw new Error(eventNamesRequired);
}
if (binding.mode !== bindingMode.twoWay && binding.mode !== bindingMode.fromView) {
throw new Error(notApplicableMessage);
}
let targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
if (!targetObserver.handler) {
throw new Error(notApplicableMessage);
}
binding.targetObserver = targetObserver;
targetObserver.originalHandler = binding.targetObserver.handler;
let handler = new EventSubscriber(events);
targetObserver.handler = handler;
}
unbind(binding, source) {
if (events.length === 0) {
throw new Error(eventNamesRequired);
}
if (binding.mode !== bindingMode.twoWay && binding.mode !== bindingMode.fromView) {
throw new Error(notApplicableMessage);
}
let targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
if (!targetObserver.handler) {
throw new Error(notApplicableMessage);
}
binding.targetObserver = targetObserver;
targetObserver.originalHandler = binding.targetObserver.handler;
let handler = new EventSubscriber(events);
targetObserver.handler = handler;
}
if (events.length === 0) {
throw new Error(eventNamesRequired);
}
if (binding.mode !== bindingMode.twoWay && binding.mode !== bindingMode.fromView) {
throw new Error(notApplicableMessage);
}
var targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
if (!targetObserver.handler) {
throw new Error(notApplicableMessage);
}
binding.targetObserver = targetObserver;
targetObserver.originalHandler = binding.targetObserver.handler;
var handler = new EventSubscriber(events);
targetObserver.handler = handler;
};