1way 中文文档教程

发布于 4年前 浏览 27 项目主页 更新于 3年前

1way

一个 1way flux-esk 状态库。 像反应挂钩但没有反应。

Installation

$ npm install --save 1way

Documentation

1way 在这一点上是一个非常简单的库。 它的灵感来自于 angular 和 react 在 HTML 中绑定 JavaScript 变量。

Why?

过去,angular 因一项名为 “双向绑定”(我相信 Backbone 首先介绍了它)。 它允许网络 开发人员将 dom 元素直接绑定到 JavaScript 中定义的变量。

立即,每个人都退出并广泛使用双向绑定。 直到 他们注意到在大型应用程序中它并不是那么好。

通过引入 Flux,Along 对绑定部分做出了反应和创新 体系结构,除其他外,它建议一种单向数据流。

现在,似乎两种方式的数据流正在重新流行起来。

<script>
  let name = 'world';
</script>

<h1>Hello {name}!</h1>
<input type="text" bind:value={name} />

(在此处 运行此代码。)

此外,我们现在正在发明 语言, 不是框架。 这对于推动标准向前发展非常有用。 但由于没有赢家 似乎已经出现了,简单地坚持 HTML5 可能会更有效。 毕竟,现在也很整洁!

Using 1way in your app

查看 index.html 以了解如何 使用 1way

Demo

此处查看演示。

Changelog

0.0.2

  • Implement integrate functionality

0.0.1

  • Initial release

Resources:

1way

A 1way flux-esk state library. Like react-hooks but without the react.

Installation

$ npm install --save 1way

Documentation

1way is a really simple library at this point. It was inspired by the way angular and react are binding JavaScript variables within HTML.

Why?

Back in the days, angular got really popular for a feature called "two-way-binding" (I believe Backbone introduced it first). It allowed a web developer to bind a dom element directly to a variable defined in JavaScript.

Immediately, everybody got exited and used two-way-binding extensively. Until they noticed that in large applications it's not that great.

Along came react and innovated on the binding part by introducing the Flux architecture, which among other things, suggested a one way data flow.

Now, it seems two way data flows are getting back in fashion.

<script>
  let name = 'world';
</script>

<h1>Hello {name}!</h1>
<input type="text" bind:value={name} />

(Run this code here.)

But additionally, we're now inventing languages, not frameworks. It's great for moving standards forward. But since no winner seems to have emerged yet, it may be more effective simply sticking to HTML5. Which is, after all, pretty neat too now!

Using 1way in your app

Check out index.html for an example of how to use 1way.

Demo

Checkout a demo here.

Changelog

0.0.2

  • Implement integrate functionality

0.0.1

  • Initial release

Resources:

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文