Created
February 9, 2015 16:52
-
-
Save odoe/3b852bec36a41537cee7 to your computer and use it in GitHub Desktop.
Container for React widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
define([ | |
'react', | |
'dojo/query', | |
'dojo/dom', | |
'dojo/dom-construct', | |
'./components/Locator' | |
], function( | |
React, | |
query, dom, domConstruct, | |
Locator | |
) { | |
var createContainer = function() { | |
var container = domConstruct.create('div', { | |
className: 'locator-container' | |
}, dom.byId('map_root'), 'first'); | |
return container; | |
}; | |
var addContainer = function(map) { | |
if (query('locator-container').length) { | |
return; | |
} | |
React.render(<Locator map={map} />, createContainer()); | |
}; | |
return { | |
addContainer: addContainer | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment