SproutCore 2.0 Beta 1 發佈

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

譯者:Jacky

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

 

因本人英文水平一般,所以翻譯錯誤在所難免,發現錯誤請郵件([email protected])通知我改正。感激不盡!

 

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的未來感到興奮,這裏很快會有更多的公告將會發布,敬請大家關注。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章