-
-
Save brikis98/1794839 to your computer and use it in GitHub Desktop.
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 getName = require('name').getName; | |
exports.hello = function() { | |
return "Hello " + getName(); | |
}; |
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
<script type="text/javascript" src="/js/inject.js"></script> | |
<script type="text/javascript"> | |
require.setModuleRoot("http://example.com/js/modules"); | |
require.run("program"); | |
</script> |
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
<script type="text/javascript" src="/js/modules/name.js"></script> | |
<script type="text/javascript" src="/js/modules/hello.js"></script> | |
<script type="text/javascript" src="/js/modules/program.js"></script> |
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
exports.getName = function() { | |
return prompt("What's your name?"); | |
}; |
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 hello = require('hello').hello; | |
alert(hello()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Serpenthelm: I believe Inject uses XHR to fetch JS files, so you need a valid domain. This means running locally, without a server, won't work, since a
file:///
path is probably not going to be recognized as a valid domain. @jakobo could comment more, but I think you'll need to fire up some sort of server (e.g. apache) to test so you can uselocalhost
as a domain.