Skip to content

Commit

Permalink
Merge pull request #40 from davidmarkclements/patch-4
Browse files Browse the repository at this point in the history
support "selected" prop
  • Loading branch information
Yomguithereal committed Feb 10, 2016
2 parents 6096f70 + f01ab32 commit 1449f07
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,19 @@ export default function update(node, options) {
// TODO: enforce some kind of shallow equality?
// TODO: handle position

const selectQue = []

for (let key in options) {
let value = options[key];

if (key === 'selected' && node.select)
selectQue.push({
node,
value: (typeof value === 'string' ? +value : value)
})

// Setting label
if (key === 'label')
else if (key === 'label')
node.setLabel(value);

// Removing hoverText
Expand Down Expand Up @@ -116,4 +124,6 @@ export default function update(node, options) {
}
}
}

selectQue.forEach(({node, value}) => node.select(value))
}

0 comments on commit 1449f07

Please sign in to comment.