请选择 进入手机版 | 继续访问电脑版

技术控

    今日:9| 主题:61683
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] RE:DOM is now 1.0!

[复制链接]
黑色无欲者 发表于 2016-10-1 19:30:07
371 1

RE:DOM is now 1.0!

RE:DOM is now 1.0!-1-技术控-channe1advis0r,bi1is0und,eng1ishp0d,the,time,is,now
       History

   Almost two years ago, March 10 2015, I released the first version of FRZR , a tiny view library. The API has changed a lot since that and even the name changed to RE:DOM . It has been a long journey, I’ve learned a lot and it’s awesome to finally be at the version 1.0! RE:DOM is definitely more than ready for production with 100 % test coverage.
  Performance

   RE:DOM is one of the fastest view libraries around. Here’s results of a performance test reordering 10 000 HTML elements :
  
       
  • ~30 ms Vanilla JS   
  • ~30 ms RE:DOM v1.0   
  • ~30 ms FRZR v0.22.7   
  • ~80 ms React v15.3.2   
  • ~500 ms React v0.14.7   
  • ~10 000 ms Riot.js v2.6.2  
  Riot.js is releasing v3 soon, I hope it will fix the performance issues..
  Filesize

  RE:DOM is 3.5 KB before and 2 KB after gzip.
  Server-side rendering

   With the release of RE:DOM 1.0, I also released NO:DOM – a complementary library for rendering RE:DOM apps/components server-side. It’s also tiny, easy to use and super fast.
  Embracing JavaScript

  There’s not that many abstractions in RE:DOM. You create components writing vanilla JavaScript. Diffing gets done against the DOM (with amazing performance though). You can refer to real DOM elements and still you get the benefit of “pure functions”, since updating the component should always go through only one update function by design. When with vdom you always redefine everything, with RE:DOM you can define the init state for component and separately how you update it.
  Here’s a basic hello world with just an HTML element:
  1. import { el, mount } from redomconst hello = el('h1', 'Hello world!')mount(document.body, hello)
复制代码
Here‘s a component version:
  1. import { el, text, mount } from redom
复制代码
  1. class Hello {  constructor () {    this.el = el('h1',      'Hello ',      this.target = text('world'),      '!'    )  }  update (target) {    this.target.textContent = target  }}
复制代码
  1. const hello = new Hello()mount(document.body, hello)
复制代码
  1. setTimeout(() => hello.update('you'), 1000)
复制代码
Future

   I believe future is bright for RE:DOM, since nothing is better than writing JavaScript as close to the metal as possible. Recently I wrote aboutmastering the DOM and talked about the JavaScript fatigue, which I believe is only cured with more minimalistic approach. In the long run you benefit the most by learning the language itself and not some third party abstractions.
   If you have any questions about RE:DOM , just raise an issue on Github , send me a tweet or send me email .
  Hope you have fun with RE:DOM!
ㄚùaИΖhI 发表于 2016-10-1 22:49:34
谁能明白谁的深爱,谁又能理解谁的离开...
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


回页顶回复上一篇下一篇回列表
手机版/c.CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表