分享

Prototype An object-oriented Javascript library

 yeqiwei 2006-01-10

README

Path: README
Last Update: Mon Apr 18 02:09:58 CDT 2005

Prototype

An object-oriented Javascript library

© 2005 Sam Stephenson (sam@)

Prototype is a Javascript library that aims to ease development of dynamic web applications. Its development is driven heavily by the Ruby on Rails framework, but it can be used in any environment.

Targeted platforms

Prototype currently targets the following platforms:

  • Microsoft Internet Explorer for Windows, version 6.0 and higher
  • Mozilla Firefox 1.0/Mozilla 1.7 and higher
  • Apple Safari 1.2 and higher

Using Prototype

To use Prototype in your application, download the latest release from the Prototype web site (prototype./) and copy dist/prototype.js to a suitable location. Then include it in your HTML like so:

  <script type="text/javascript" src="/path/to/prototype.js"></script>

Building Prototype from source

prototype.js is a composite file generated from many source files in the src/ directory. To build Prototype, you’ll need:

  • a copy of the Prototype source tree, either from a distribution tarball or from the darcs repository (see below)
  • Ruby 1.8.2 or higher (www./)
  • Rake — Ruby Make (rake./)
  • RDoc, if your Ruby distribution does not include it
  • darcs 1.0.1 or higher (/darcs/; static binaries available at www./DarcsWiki/CategoryBinaries)

From the root Prototype directory,

  • rake generate_dist_prototype will run script/make-dist.rb, which preprocesses the Prototype source and generates the single-file dist/prototype.js.
  • rake generate_dist_tarball will run the aforementioned task and create a distribution tarball of your current darcs repository with darcs dist. (rake dist, or just rake, can be used for this, too.)

Contributing to Prototype

You‘ll need the tools mentioned above. Modify the files in src/, add tests in test/ if possible, generate a new dist file, and record the changes with darcs record -al. Then email patches to sam@ using darcs send.

Documentation

Prototype is embarrassingly lacking in documentation. (The source code should be fairly easy to comprehend; I’m committed to using a clean style with meaningful identifiers. But I know that only goes so far.)

Much of the problem is that there is no easy way to document it from within the source code itself. I’ve tried JSDoc and a Perl script included with JsUnit; neither groks Prototype’s hash-style class definitions or inheritance scheme. Making them work would require major changes, and I don’t have the time for that right now.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多