当前位置: 首页 > 工具软件 > SproutCore > 使用案例 >

SproutCore 2.0 Beta 1 发布

佘单鹗
2023-12-01

本文为翻译文章,文章原文:http://blog.sproutcore.com/sproutcore-2-0-beta-1-released/

译者:Jacky

博客:http://blog.csdn.net/varkychan

 

因本人英文水平一般,所以翻译错误在所难免,发现错误请邮件(jacky@iajax.net)通知我改正。感激不尽!

 

A few weeks ago, we announced SproutCore 2.0: a rebuilt version of the framework designed to be leaner, easier to learn, and optimized for mobile devices. We knew that in order to continue building for the expanding portfolio of mobile devices, we first had to have a strong foundation.

 

前几周,我们宣布了SproutCore2.0,是对SproutCore1.x的重构版本,主要针对初学者,易于学习,并针对移动设备进行了优化。我们知道,我们必需有一个坚实的基础架构,才能够持续地为正在不断扩张的移动设备进行应用开发。

 

The ultimate goal for SproutCore 2.0 is feature-parity with the 1.x series. As the first step towards that goal, we released the SproutCore Starter Kit, based on HTML5 Boilerplate . The Starter Kit contains a default HTML page, jQuery, and both minified and unminified versions of SproutCore 2.0. The Starter Kit is great for building web-style apps, and the response by developers has been overwhelmingly positive. People love combining the power of SproutCore’s bindings, computed properties, and templates with raw HTML and CSS.

 

SproutCore2.0的最终目标是与1.x系列具有相同的功能。为了达到这个目标,我们的第一步是发布了 SproutCore Starter Kit,它是基于HTML5 Boilerplate 的. Starter Kit 包含一个默认的HTML页面、jquery以及压缩版和未压缩版的SproutCore2.0。用Starter Kit创建网页风格的页面非常棒,得到开发者热烈的响应。人们喜欢用纯HTML和CSS来结合使用SproutCore的绑定、计算属性(computed properties)及模板的强大功能。

 

We’ve received a lot of great feedback and bug reports from the community. In particular, we’d like to thank Erik Bryn, Trek Glowacki, Matt Good and Peter Wagenet for submitting new features and bug fixes, Alexander Flatter, Roberto Saccon and Ryan Farnell for bug reports, and Erich Ocean, Gimi Liang and Mike Ball for documentation improvements. Today, we have a new release that incorporates all of these changes.

 

我们从社区收到很多很好的反馈和错误报告,尤其是要多谢Erik Bryn、Trek Glowacki、Matt Good以及Peter Wagenet,他们提交了新的功能程序及漏洞补丁;Alexander Flatter、Roberto Saccon和Ryan Farnell提交了漏洞报告;Erich Ocean、Gimi Liang和Mike Ball对文档进行了改进。今天,我们发布了一个包含所有这些修改的新版本。

 

Features

重要特性

  • {{#collection}} supports select/option tags (thanks Trek!)
  • {{#collection}} 支持 select/option 标签(多谢Trek!)
  • SC.Button supports the type attribute (thanks Erik!)
  • SC.Button 支持type属性(多谢Erik!)
  • SC.Views support attribute bindings
  • SC.Views 支持属性(attribute)绑定
  • SC.View now defers rendering until after bindings have finished syncing
  • SC.View 现在推迟程现(rendering),直到绑定完成同步
  • Applications can specify custom events to dispatch to views
  • 应用程序可以向视图指派(dispatch)自定义事件

Bug Fixes

修复错误

  • SC.RenderBuffer was joining strings with a comma instead of an empty string (thanks Alex!)
  • SC.RenderBuffer 以逗号(,)来分隔字符串与不是用空字符串(多谢Alex!)
  • Improve workaround for a bug where Object.defineProperty doesn’t work on DOM elements in Safari 5
  • 改进 Safari5 中 Object.defineProperty 在 DOM 元素中不起作用的解决方案
  • Doesn’t reset cursor position when typing in a bound text field
  • 在输入框中输入时没有重置光标位置
  • The value of {{bindAttr}} being over-escaped
  • {{bindAttr}}的值被重复转码(escape
  • SC.CollectionView properly removes its empty view
  • SC.CollectionView 适当地移除它的空视图
  • Fixed compatibility with browsers that don’t support Date.now()
  • 修复某些浏览器不支持Date.now()的兼容性问题
  • Fixes a typo in ES5 descriptors
  • 改正ES5描述中的书写错误
  • Documentation improvements
  • 完善文档

API Changes

API改动


We’re happy to report that only one API change was necessary for this release. In the previous versions, instances of SC.View would invoke didCreateElement once the DOM element for a view was created. However, this callback happened before the element was inserted into the DOM, and the precise timing for the callback was mostly undefined.

As of SproutCore 2.0 beta 1, we are replacing that callback with two new callbacks with more precise semantics:

 

我们很高兴地告诉你,这个发布版只有一个API发生了改变。在之前的版本,SC.View的实例将会在一个视图(view)的 DOM 元素被创建时回调一次 didCreateElement 方法。然而,这个回调将在这个元素被插入到 DOM 前发生,并且回调的精确时间通常不明确。在SproutCore 2.0 beta 1中,我们将用两个语义更精确的新回调来代替这个回调。

  • willInsertElement: this callback is called immediately before the element is inserted into the DOM. It is guaranteed to run after the bindings for the view object have synchronized.
  • willInsertElement:这个回调在元素被插入到 DOM 前即时发生,它保证在视图对象绑定同步完成后执行。
  • didInsertElement: this callback is called immediately after the element is inserted into the DOM. It is also guaranteed to run after binding synchronization.
  • didInsertElement:这个回调在元素被插入到 DOM 后即时发生,它也保证在绑定同步后被执行。

In general, if you are integrating with external JavaScript libraries, you will want to initialize them inside the didInsertElement callback.


通常,如果你要集成外部的JavaScript库,你最好在 didInsertElement 回调中初始化它们。

 

Download

下载


To get started with SproutCore 2.0 Beta 1, download the updated Starter Kit . If you’ve already started writing a SproutCore 2.0 app, just copy the JavaScript file from js/libs/sproutcore-2.0.beta.1.js to your existing application.

If you’re just getting started, be sure to read the SproutCore 2.0 announcement blog post . If you find bugs or run into trouble, please file an issue on our GitHub Issues page . We hope you’re as excited about the future of SproutCore as we are, and stay tuned for even more announcements that will be posted here soon.


要开始使用SproutCore 2.0 Beta 1,下载已更新的 Starter Kit 。如果你已经开始了 SproutCore 2.0 应用的编写,则只需要复制 js/libs/sproutcore-2.0.beta.1.js 文件到你的应用程序中。如果你才刚刚开始,你必须先阅读 SproutCore 2.0 的公告博文 。如果你发现错误或遇到问题,请在 GitHub 的问题(Issues)页上登记 。我们希望你像我们一样对SproutCore的未来感到兴奋,这里很快会有更多的公告将会发布,敬请大家关注。

 类似资料: