Created
June 4, 2015 21:37
-
-
Save alistair/4dbc225a2cf5c8c19edd to your computer and use it in GitHub Desktop.
portlets in SPAs
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
// Admin App Host application | |
require('something') // we need to force load all modules, could this be by convention? | |
var Registration = require('register'); | |
var links = Registration.get(); | |
for(var i in links) | |
{ | |
print("<a href='+i.url+' >' + i.title +'</a> | |
} |
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
/* | |
The smae idea could be applied to react. just replace a the url with a function which happens to return a component | |
something like | |
*/ | |
require('something') // we need to force load all modules, could this be by convention? | |
var Registration = require('register'); | |
var links = Registration.get(); { id: ..., ; title: ...., function: ....} | |
var MainApplicationWindow = React.createClass({ | |
var subComponents = links.map(function (item) { | |
return ( | |
<div id={item.id}> | |
<h1>{item.title}</h1> | |
{item.function()} | |
</div> | |
); | |
return { | |
<div> | |
{subComponents} | |
</div> | |
} | |
} | |
exports = MainApplicationWindow |
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
var Registration = reguire('register'); | |
Registration.register('ats', 'Manage Ats', '//hello.world/api'); |
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
var registrations = []; | |
var register = function(id, title, url) { | |
registrations.push({ 'id': id, 'title': title, 'url': url}) | |
} | |
var get = function() { return registrations; }; | |
exports = { register: register, getRegistrations: get }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment