在Web服务器中运行dart [英] Running dart in a web server

查看:109
本文介绍了在Web服务器中运行dart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在服务器中运行飞镖?说在localhost或任何Web服务器?目前google提供了一个dart编辑器,它在dartium浏览器中执行代码。

How do I run dart in a server? say in localhost or any web server? Currently google provides a dart editor which executes the code in dartium browser. Also even if I get to run it on a server would it be visible to others viewing the page in a browser other than dartium?

推荐答案

MyApp.html //contains <script type="application/dart" src="MyApp.dart"></script>
MyApp.dart //contains dart app code.

编辑器也可以从.dart文件生成一个javascript文件,例如:

The editor can also generate a javascript file from the .dart file, eg:

MyApp.dart.js //contains dart app code converted to JS

对于Web服务器,这些仅仅是提供给浏览器的静态文件。

As far as a web server is concerned, these are simply static files that get served to the browser.

文件包含指向特殊JavaScript脚本的链接,该脚本可以标识正在使用的浏览器是否具有对Dart(即Dartium)的本机支持。

The html file contains a link to a special JavaScript script which can identify if the browser being used has native support for Dart (ie, Dartium).


  • 如果存在,则使用MyApp.html和MyApp.dart文件对。

  • If it does, then then the MyApp.html and MyApp.dart pair of files is used.

如果浏览器不支持Dart,那么特殊脚本会动态更改脚本元素以指向MyApp.dart.js文件,以便浏览器接收javascript

If the browser does not support Dart natively, then the special script dynamically changes the script element to point to the MyApp.dart.js file instead, so that the browser receives the javascript version of your app.

这意味着您可以复制三个文件(.html,.dart,.js )到任何网络服务器(localhost或其他),并简单地浏览到.html文件。

This means that you can copy the three files (.html, .dart, .js) onto any web server (localhost or otherwise), and simply browse to the .html file.

为了完整性,可以看到特殊脚本:
http://dart.googlecode.com/svn/branches/bleeding_edge/dart/ client / dart.js

For completeness, the "special script" can be viewed here: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js

这篇关于在Web服务器中运行dart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆