Skip to content

Instantly share code, notes, and snippets.

@chochos
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chochos/9dc8227e6cc4893f5654 to your computer and use it in GitHub Desktop.
Save chochos/9dc8227e6cc4893f5654 to your computer and use it in GitHub Desktop.
Example of entry point to use ceylon-js
<html>
<head>
<title>simple ceylon-jsjs test</title>
<script type="text/javascript" src="../ceylon-web-ide-backend/src/main/webapp/scripts/require.js" data-main="simple.js"></script>
</head>
<body>
</body></html>
require.config({
baseUrl: "build",
waitSeconds: 5,
paths:{
'ceylon/language':'runtime/ceylon/language',
'check':'test/proto/check'
}
});
require(["ceylon/language/1.1.0/ceylon.language-1.1.0", 'check/0.1/check-0.1'], function(cl, check) {
cl.print(cl.$_String("testing",4));
check.check(false, cl.$_String("it runs!",6));
cl.getProcess().write("probando 1 ");
cl.getProcess().write("probando 2 ");
cl.getProcess().writeLine("Probando 3");
cl.getProcess().writeLine("Probando 4");
});
@chochos
Copy link
Author

chochos commented Aug 27, 2014

You don't always have to load the language module; only the modules you directly use in the code for your entry point. For example this works:

require(['check/0.1/check-0.1'], function(check) {
    check.check(false, "OK!");
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment