JavaScript赢了:用Mozilla Shumway运行Flash并用Fayde在JS中开发Silverlight
Well this is some amazing news that has been a long time coming. You can take your Flash apps and run them without Flash, and take your Silverlight apps and (almost) run them without Silverlight.
好吧,这是一个令人惊奇的消息,已经有很长时间了。 您可以使用Flash应用程序并在没有Flash的情况下运行它们,也可以使用Silverlight应用程序,并且(几乎)在没有Silverlight的情况下运行它们。
If you still don't think JavaScript has won the web, please read on.
如果您仍然认为JavaScript无法赢得网络,请继续阅读。
Shumway-JavaScript和HTML 5中的Flash (Shumway - Flash in JavaScript and HTML 5)
The Mozilla Project "Shumway" has been a long time coming (as long ago as 2012, but it's now ready to be looked at more deeply).
Mozilla项目“ Shumway ”已经有很长时间了(早在2012年,但现在已经准备好进行更深入的研究了)。
Chris Peterson, a Program Manager on the Mozilla Shumway says:
Mozilla Shumway的项目经理Chris Peterson说:
"Shumway is in a race to stay relevant as Flash fades from the web, but there will always be a long-tail of Flash content that would/will be lost when Adobe or browsers stop supporting the Flash plugin."
“随着Flash从网络上淡出, Shumway一直在努力保持相关性,但是当Adobe或浏览器停止支持Flash插件时,总是会有大量的Flash内容丢失/丢失。”
Think about that. We've all largely got "Evergreen Browsers" now that update themselves as often as weekly, but sometimes it feels like Adobe Flash is being attacked daily, so we're told to update that as well. Flash itself has more than fallen from grace, as Chris points out, it's fading from the web itself. Fast forward a year or so when there is no more Flash installed, but there's still Flash on the web. Enter Shumway - it's a renderer for SWF (Flash files) without native code! Shumway literally.
考虑一下。 现在,我们所有人都已经有了“ Evergreen Browsers”,它们每周更新一次,但是有时感觉Adobe Flash每天都在受到攻击,因此我们也被告知也要进行更新。 正如克里斯指出的那样,Flash本身已经从优雅中跌落了很多,它正在从网络本身中消失。 快进一年了,这时不再安装Flash,但网络上仍然有Flash。 输入Shumway-它是没有本机代码的SWF(Flash文件)渲染器! 从根本上说,Shumway。
Why is it called Shumway? Again, Chris:
为什么叫Shumway? 克里斯再次:
"The name "Shumway" is derived from "Gordon Shumway", the actual name of the TV character ALF: Flash -> Flash Gordon -> Gordon Shumway -> Shumway."
“名称“ Shumway”源自电视角色ALF的实际名称“ Gordon Shumway”:Flash-> Flash Gordon-> Gordon Shumway-> Shumway。”
That's awesome. What else is awesome? "Shumway is written in TypeScript. It has an ActionScript interpreter and a JIT that generates JavaScript, compiled using eval()."
棒极了。 还有什么很棒的? “ Shumway用TypeScript编写。它具有一个ActionScript解释器和一个使用eval()编译的生成JavaScript的JIT。”
So Shumway is an HTML experiment that uses TypeScript (a modern typed JavaScript compiler/transpiler) to read ActionScript and resources and JIT the result into evaluated JavaScript. Fantastic. It's also open source and on GitHub. Even better, the Firefox Nightly is using Shumway for Flash videos on Amazon.com. This is the beginning of their test, I presume, to sunset Flash in Firefox.
因此, Shumway是一个HTML实验,它使用TypeScript(一种现代类型JavaScript编译器/翻译器)读取ActionScript和资源,并将结果JIT到经过评估JavaScript中。 太棒了它也是开源的,并且在GitHub上。 更好的是,Firefox Nightly在Amazon.com上将Shumway用于Flash视频。 我想,这是他们测试Firefox日落Flash的开始。
Fayde-JavaScript和HTML5画布中的Silverlight (Fayde - Silverlight in JavaScript and HTML5 Canvas)
At the same time, there's The Fayde project. Also Open Source, Fayde also compiles to JavaScript. But Fayde transforms Silverlight into HTML5 Canvas and JavaScript! It's an implementation of a XAML engine in JS. Here's a near-Silverlight implementation of the classic Todo application, expressed on the web without plugins. Not enough? Here's a complex Fantasy Football app written in a Silverlight-like environment but running in your browser, again, without Silverlight.
同时,还有Fayde项目。 Fayde也是开源的,也可以编译为JavaScript。 但是Fayde将Silverlight转换为HTML5 Canvas和JavaScript! 它是JS中XAML引擎的实现。 这是经典Todo应用程序的接近Silverlight的实现,在Web上无需插件即可表示。 不够? 这是一个在类似Silverlight的环境中编写的复杂的Fantasy Football应用,但是再次在您的浏览器中运行,而没有Silverlight。
To be clear, there are significant architectural differences between these two projects. Shumway reads the binary SWF format and tries to Be Flash, while Fayde is reimagining, if you will, that takes the Silverlight concepts of ViewModels and Views in XAML and adds TypeScript (a comfortable language for the C#-familiar) with the result rendered on a Canvas. It's not a Silverlight Emulator, it's a Silverlight-like implementation and app development pattern for HTML5. It's open source, and they are looking for participation, so head over and get involved! Fayde may be the Silverlight migration strategy you've been looking for.
需要明确的是,这两个项目之间存在重大的体系结构差异。 Shumway会读取二进制SWF格式并尝试将其设为Flash,而Fayde会重新构想(如果愿意),它采用XAML中ViewModels和Views的Silverlight概念,并添加TypeScript(一种熟悉C#的舒适语言),并将结果呈现在画布。 它不是Silverlight模拟器,而是HTML5的类似于Silverlight的实现和应用程序开发模式。 它是开源的,他们正在寻求参与,所以赶快加入吧! Fayde可能是您一直在寻找的Silverlight迁移策略。
Aside: From my perspective, it's not unreasonable to imagine taking something like JSIL (listen to my podcast on this amazing project) or a similar IL->JS system and combine it with Fayde to somehow run XAPs as well.
另外:从我的角度来看,可以想象采用JSIL之类的东西(在这个令人惊叹的项目上收听我的播客)或类似的IL-> JS系统,并将其与Fayde结合起来以某种方式运行XAP并非没有道理。
I love how crazy JavaScript is and what people have been able to do with it. Now, go run this PC Emulator (~virtual machine) written by Fabrice Bellard in JavaScript. It's Linux, on a 486, in your browser, in JavaScript. *brain explodes*
我喜欢JavaScript多么疯狂,人们已经能够使用它。 现在,运行由Fabrice Bellard用JavaScript编写的PC仿真器(〜虚拟机)。 它是Linux,在486中,在您的浏览器中,在JavaScript中。 *大脑爆炸*
Have a lovely day and enjoy today's Open Web.
祝您有美好的一天,并享受今天的开放式网络。
关于斯科特 (About Scott)
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
斯科特·汉塞尔曼(Scott Hanselman)是前教授,前金融首席架构师,现在是演讲者,顾问,父亲,糖尿病患者和Microsoft员工。 他是一位失败的单口相声漫画家,一个玉米种植者和一本书的作者。