Bindable.js [](<a href="https://github.com/classdojo/bindable.js#projects-using-">https://github.com/classdojo/bindable.js#projects-using-</a> 双向数据绑定JS库

程序名称:Bindable.js [](<a href="https://github.com/classdojo/bindable.js#projects-using-">https://github.com/classdojo/bindable.js#projects-using-</a>

授权协议: MIT

操作系统: 跨平台

开发语言: JavaScript

Bindable.js [](<a href="https://github.com/classdojo/bindable.js#projects-using-">https://github.com/classdojo/bindable.js#projects-using-</a> 介绍

Bindable.js 实现了灵活、快速的双向数据绑定的 JavaScript 库。

Two-way data binding means linking properties of two separate objects - when
one changes, the other will automatically update with that change. It enables
much easier interactions between data models and UIs, among other uses outside
of MVC.

Bindable.js is similar to Ember’s data-binding system, except it doesn’t
include anything View related, so the library has many use-cases - whether
replacing Backbone’s Model, providing a way to maintain the state between
server <-> client for a realtime front-end application (similar to Firebase),
or perhaps a way to communicate between server <-> server for a realtime
distributed Node.js application.

[](https://github.com/classdojo/bindable.js#projects-using-

bindablejs)Projects using bindable.js

  • Paperclip.js - data-bindable templating engine.

  • Sherpa.js - online tours library

  • Mojo.js - javascript MVC framework.

  • AWSM - aws library.

  • ditto - synchronized user interactions across browsers.

示例代码:

var bindable = require("bindable");

var person = new bindable.Object({
  name: "craig",
  last: "condon",
  location: {
    city: "San Francisco"
  }
});

person.bind("location.zip", function(value) {
  // 94102
}).now();

//triggers the binding
person.set("location.zip", "94102");

//bind location.zip to another property in the model, and do it only once
person.bind("location.zip", { to: "zip", max: 1 }).now();

//bind location.zip to another object, and make it bi-directional.
person.bind("location.zip", { target: anotherModel, to: "location.zip", bothWays: true }).now();

//chain to multiple items, and limit it!
person.bind("location.zip", { to: ["property", "anotherProperty"], max: 1 }).now();


//you can also transform data as it's being bound
person.bind("name", {
  to: "name2",
  map: function (name) {
    return name.toUpperCase();
  }
}).now();

Bindable.js [](<a href="https://github.com/classdojo/bindable.js#projects-using-">https://github.com/classdojo/bindable.js#projects-using-</a> 官网

https://github.com/classdojo/bindable.js

相关编程语言

MuPlayer 是一款跨平台、轻量级的音频播放解决方案,...
OS FLV 是一个 开源和可嵌入网页的flv播放器。 这个...
DewPlayer音乐播放器,样式很简单,而且很实用.播放器...
JW FLV MEDIA PLAYER是一个开源的在网页上使用的Fla...
Speakker 是一个基于 Web 浏览器的音乐播放器,只提...
Player Framework 是一个开源的支持 HTML5 的视频播...