Skip to content

Commit

Permalink
move default options into track
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Oct 26, 2015
1 parent b424763 commit ef51418
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/main/PileupTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ PileupTrack.propTypes = {
options: React.PropTypes.object
};
PileupTrack.displayName = 'pileup';
PileupTrack.defaultOptions = {
viewAsPairs: false
};


module.exports = PileupTrack;
6 changes: 3 additions & 3 deletions src/main/pileup.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ function create(elOrId: string|Element, params: PileupParams): Pileup {

type VizObject = ((options: ?Object) => {component: React.Component, options:?Object});

function makeVizObject(component: React.Component, defaultOptions: ?Object): VizObject {
function makeVizObject(component: React.Component): VizObject {
return options => {
options = _.extend({}, defaultOptions, options);
options = _.extend({}, component.defaultOptions, options);
return {component, options};
};
}
Expand All @@ -132,7 +132,7 @@ var pileup = {
location: makeVizObject(LocationTrack),
scale: makeVizObject(ScaleTrack),
variants: makeVizObject(VariantTrack),
pileup: makeVizObject(PileupTrack, {viewAsPairs: false})
pileup: makeVizObject(PileupTrack)
}
};

Expand Down

0 comments on commit ef51418

Please sign in to comment.