JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 22
  • Score
    100M100P100Q45953F

data.js 是带有消息通知的数据中心,我把她称为活的数据。旨在让编程变得简单,世界变得美好。

Package Exports

  • data_js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (data_js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#data.js Build Status Built with Grunt

data.js 是带有消息通知的数据中心,我把她称为活的数据。旨在让编程变得简单,世界变得美好。

##用途

  1. 全局数据中心,可以用来存放数据,在不同程序中共享。
  2. 将程序的耦合度,变为数据耦合,采用隐式调用风格,发挥js事件风格。

##兼容性

  • node.js 0.10+
  • Safari 6+ (Mac)
  • iOS 5+ Safari
  • Chrome 23+ (Windows, Mac, Android, iOS, Linux, Chrome OS)
  • Firefox 4+ (Windows, Mac, Android, Linux, Firefox OS)
  • Internet Explorer 6+ (Windows, Windows Phone)
  • Opera 10+ (Windows, linux, Android)

##使用方法

###传统方法

//在程序的最开始处添加如下js
<script src="data.js"></script>
<script>
    Data.set('a', 123);
</script>

###AMD

require(['data'], function (Data) {
    Data.set('a', 123);
});

###bower

$ bower install data.js

###node.js

$ npm install data_js//从npm安装

*.js
var Data = require('data');
Data.set('a', 123);

即可使用data.js,在传统浏览器环境data.js占用全局命名空间 Data

##DEMO

接口简洁,使用简单:

Data.sub('set', 'a', function (e) {console.log(e.data)});//订阅消息,当a被设置时,会派发消息

Data.set('a', 1);//存入数据

Data.get('a');//读取数据

更多例子,请见目录下的demo目录。

##文档

API

##作者

yanhaijing

##报告问题

##版权信息

Copyright © 2013 yanhaijing. All Rights Reserved

Licensed under the MIT-LICENSE; you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: http://opensource.org/licenses/MIT