首页IT科技starry几岁(Ringo)

starry几岁(Ringo)

时间2025-09-19 11:47:44分类IT科技浏览4542
导读:Ringo Ringo is a CommonJS-based JavaScript runtime written in Java and based on the Mozilla Rhino...

Ringo

Ringo is a CommonJS-based JavaScript runtime written in Java and based on the Mozilla Rhino

JavaScript engine.

Download the final Ringo 0.8 release!

Our primary goal is to build a stable, high-performance runtime for server-side use.

The following code is all you need to create a simple web app: exports.app = function(req) { return { status: 200, headers: {"Content-Type": "text/plain"}, body: ["Hello World!"] }; }; if (require.main == module) require("ringo/httpserver").main(module.id);

Simply save the code above as "server.js" and run it by executing ringo server.js.

Like most Ringo apps, this app will automatically reload, picking up any changes you make

without requiring a restart.

But Ringo lets you do more than write web applications. It allows you to

seamlessly use any Java class or library simply by dropping it into the classpath.

The following code shows how to build a simple desktop application with Swing: var {JFrame, JButton} = javax.swing; function main() { var frame = new JFrame("Hello World!"); var button = new JButton("Bye bye"); button.addActionListener(function(e) { system.exit(); }); frame.add("Center", button); frame.setSize(300, 300); frame.setVisible(true); } if (require.main == module) main();

See the Wiki or documentation page to learn

more about Ringo!

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
linux安装vmvare软件包未被识别怎么办(Linux下安装vagrant过程出现问题如何解决?)