Skip to content

Commit

Permalink
fix: standalone build (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyuhen authored Mar 26, 2019
1 parent cddf8a3 commit 359af25
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/griffith-standalone/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ import ReactDOM from 'react-dom'
import Player from 'griffith'

export function createPlayer(target) {
function render(props) {
ReactDOM.render(<Player {...props} />, target)
}

render()

return {
render(props) {
ReactDOM.render(<Player {...props} />, target)
render(props)
return this
},

dispose() {
ReactDOM.unmountComponentAtNode(target)
ReactDOM.render(null, target)
return this
},
}
}

0 comments on commit 359af25

Please sign in to comment.