Skip to content

Commit

Permalink
Use case-map lib in a saner way.
Browse files Browse the repository at this point in the history
In this file currently you can refer to the function as: caseMap.dashToCamelCase, CaseMap.dashToCamelCase, or dashToCamelCase. Let's just do a standard import style here.
  • Loading branch information
rictic committed Aug 16, 2018
1 parent 658d1cf commit 7241ec5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/mixins/property-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ import '../utils/boot.js';
import { dedupingMixin } from '../utils/mixin.js';
import { root as root$0, isAncestor, isDescendant, get as get$0, translate, isPath as isPath$0, set as set$0, normalize } from '../utils/path.js';
/* for notify, reflect */
import * as caseMap from '../utils/case-map.js';
import { camelToDashCase as camelToDashCase$0, dashToCamelCase } from '../utils/case-map.js';
import { camelToDashCase, dashToCamelCase } from '../utils/case-map.js';
import { PropertyAccessors } from './property-accessors.js';
/* for annotated effects */
import { TemplateStamp } from './template-stamp.js';
import { sanitizeDOMValue } from '../utils/settings.js';

/** @const {Object} */
const CaseMap = caseMap;

// Monotonically increasing unique ID used for de-duping effects triggered
// from multiple properties in the same turn
let dedupeId = 0;
Expand Down Expand Up @@ -272,7 +268,7 @@ function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) {
function notifyPath(inst, path, props) {
let rootProperty = root$0(path);
if (rootProperty !== path) {
let eventName = camelToDashCase$0(rootProperty) + '-changed';
let eventName = camelToDashCase(rootProperty) + '-changed';
dispatchNotifyEvent(inst, eventName, props[path], path);
return true;
}
Expand Down Expand Up @@ -492,7 +488,7 @@ function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, li
// Add listener info to binding metadata
if (shouldAddListener(binding)) {
let {event, negate} = binding.parts[0];
binding.listenerEvent = event || (CaseMap.camelToDashCase(target) + '-changed');
binding.listenerEvent = event || (camelToDashCase(target) + '-changed');
binding.listenerNegate = negate;
}
// Add "propagate" property effects to templateInfo
Expand Down Expand Up @@ -2127,7 +2123,7 @@ export const PropertyEffects = dedupingMixin(superClass => {
this._addPropertyEffect(property, TYPES.NOTIFY, {
fn: runNotifyEffect,
info: {
eventName: CaseMap.camelToDashCase(property) + '-changed',
eventName: camelToDashCase(property) + '-changed',
property: property
}
});
Expand Down

0 comments on commit 7241ec5

Please sign in to comment.