开发者

making script# samples work?

开发者 https://www.devze.com 2023-03-01 00:46 出处:网络
They all fail for me The photo one does nothing. I see a text box and a browse button The other two fail immediately with saying that window.addEventListener is an unknown method

They all fail for me

The photo one does nothing. I see a text box and a browse button

The other two fail immediately with saying that window.addEventListener is an unknown method

I really bought the vision after watching mix11 talk. But not being able to see the source, there being almost no docs and the samples all fail开发者_开发知识库ing has made me ready to change my mind

Anybody got any suggestion for the samples, or other ways to re-inspire me (I have a LOT of javascript to write)

edit: well I have found that the samples all work in chrome but not IE8!


I think samples are out of date, though didn't even try them since i started using Script#, as i'm only interested in generating scripts in a type safe environment with compile time checking and intellisense.

If you are going to write lots of scripts, ScriptSharp would help you a lot. Even though i have many years of experience with javascript and feel comfortable working with it, when you develop a web application (not just a few pages) with several ten thousands of script lines, it becomes a very tedious work to modify/extend classes, options, libraries.

Lets list some pros/cons:

PROS:

  • Intellisense
  • Type safety (harder to pass wrong argument types to functions etc.)
  • Compile time syntax checking (e.g. no extra comma errors, headaches in IE)
  • Will feel safer to change code, add features (my number 1 feature)
  • Can import any existing script plugin, and you don't have to memorize their options once you did.
  • Familiar object oriented design (it maps to simple prototype inheritance in JS)
  • Generated script almost 1-1 matches original source

CONS:

  • Don't have a steep learning curve but need to learn basics
  • Takes some time to import your existing code
  • Might miss some C#3/JS features like object initializer, implicitly typed variables, extension methods etc. This means you will have to write a few more lines than matching JS code.
  • May cause some addiction and reverting back to write plain scripts will feel harder.
  • Don't have a big community like GWT (though its improving with recently setup Git repository etc)


The MIX11 code and slides were published here:

http://www.nikhilk.net/ScriptSharp-MIX11.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消