<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          DeLoreanFlux 模式實現(xiàn)

          聯(lián)合創(chuàng)作 · 2023-09-23 17:17

          DeLoreanjs(Delorean.js) 是極小的 Flux 模式實現(xiàn):

          • 單向數(shù)據(jù)流,是的你的應(yīng)用邏輯比 MVC 還簡單

          • 自動監(jiān)聽數(shù)據(jù)變化情況,保持數(shù)據(jù)持續(xù)更新


          • 這是個很完整的框架,沒有視圖框架

          • 非常小,壓縮后只有 4K

          • 內(nèi)置 React.js 集成,易于使用 Flight.jsReactive.js 或者其他的 JS 庫

          • 使用回滾提高 UI 和數(shù)據(jù)的一致性

          示例:

          /* * Stores are simple data buckets which manages data. */var Store = Flux.createStore({
            data: null,
            setData: function (data) {
              this.data = data;
              this.emit('change');
            },
            actions: {
              'incoming-data': 'setData'
            }});var store = new Store();/* * Dispatchers are simple action dispatchers for stores. * Stores handle the related action. */var Dispatcher = Flux.createDispatcher({
            setData: function (data) {
              this.dispatch('incoming-data', data);
            },
            getStores: function () {
              return {increment: store};
            }});/* * Action Creators are simple controllers. They are simple functions. *  They talk to dispatchers. They are not required. */var Actions = {
            setData: function (data) {
              Dispatcher.setData(data);
            }};// The data cycle.store.onChange(function () {
            // End of data cycle.
            document.getElementById('result').innerText = store.store.data;});document.getElementById('dataChanger').onclick = function () {
            // Start data cycle:
            Actions.setData(Math.random());};


          瀏覽 16
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  www.操逼逼 | 婷婷亚洲综合五月天小说 | 操逼视频动漫 | 日韩无码中文字幕电影 | 青青草日逼视频 |