Adjust code to work with es5 as a target.

master
Tom Hacohen 7 years ago
parent a6ad199023
commit 4f88ff6364

@ -33,7 +33,7 @@ class SyncGate extends React.PureComponent {
componentWillReceiveProps(nextProps: PropsTypeInner) { componentWillReceiveProps(nextProps: PropsTypeInner) {
if (nextProps.journals.value && (this.props.journals.value !== nextProps.journals.value)) { if (nextProps.journals.value && (this.props.journals.value !== nextProps.journals.value)) {
for (const journal of nextProps.journals.value) { nextProps.journals.value.forEach((journal) => {
let prevUid: string | null = null; let prevUid: string | null = null;
const entries = this.props.entries.get(journal.uid); const entries = this.props.entries.get(journal.uid);
if (entries && entries.value) { if (entries && entries.value) {
@ -42,7 +42,7 @@ class SyncGate extends React.PureComponent {
} }
store.dispatch(fetchEntries(this.props.etesync, journal.uid, prevUid)); store.dispatch(fetchEntries(this.props.etesync, journal.uid, prevUid));
} });
} }
} }

@ -9,7 +9,7 @@ import * as EteSync from './api/EteSync';
export function syncEntriesToItemMap(collection: EteSync.CollectionInfo, entries: List<EteSync.SyncEntry>) { export function syncEntriesToItemMap(collection: EteSync.CollectionInfo, entries: List<EteSync.SyncEntry>) {
let items: {[key: string]: ContactType} = {}; let items: {[key: string]: ContactType} = {};
for (const syncEntry of entries) { entries.forEach((syncEntry) => {
let comp = new ContactType(new ICAL.Component(ICAL.parse(syncEntry.content))); let comp = new ContactType(new ICAL.Component(ICAL.parse(syncEntry.content)));
const uid = comp.uid; const uid = comp.uid;
@ -23,7 +23,7 @@ export function syncEntriesToItemMap(collection: EteSync.CollectionInfo, entries
} else if (syncEntry.action === EteSync.SyncEntryAction.Delete) { } else if (syncEntry.action === EteSync.SyncEntryAction.Delete) {
delete items[uid]; delete items[uid];
} }
} });
return items; return items;
} }
@ -54,11 +54,11 @@ export function syncEntriesToCalendarItemMap(collection: EteSync.CollectionInfo,
const color = colorIntToHtml(collection.color); const color = colorIntToHtml(collection.color);
for (const syncEntry of entries) { entries.forEach((syncEntry) => {
let comp = EventType.fromVCalendar(new ICAL.Component(ICAL.parse(syncEntry.content))); let comp = EventType.fromVCalendar(new ICAL.Component(ICAL.parse(syncEntry.content)));
if (comp === null) { if (comp === null) {
continue; return;
} }
comp.color = color; comp.color = color;
@ -74,7 +74,7 @@ export function syncEntriesToCalendarItemMap(collection: EteSync.CollectionInfo,
} else if (syncEntry.action === EteSync.SyncEntryAction.Delete) { } else if (syncEntry.action === EteSync.SyncEntryAction.Delete) {
delete items[uid]; delete items[uid];
} }
} });
return items; return items;
} }

@ -2,7 +2,7 @@
"compilerOptions": { "compilerOptions": {
"outDir": "build/dist", "outDir": "build/dist",
"module": "esnext", "module": "esnext",
"target": "es2015", "target": "es5",
"lib": ["es6", "dom"], "lib": ["es6", "dom"],
"sourceMap": true, "sourceMap": true,
"allowJs": true, "allowJs": true,

Loading…
Cancel
Save