芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/node_modules/brcast/README.md
# Brcast > Tiny data broadcaster with 0 dependencies [](https://travis-ci.org/vesparny/brcast) [](https://codecov.io/github/vesparny/fair-analytics) [](https://david-dm.org/vesparny/brcast) [](https://www.npmjs.com/package/brcast) [](https://npm-stat.com/charts.html?package=brcast&from=2017-04-01) [](http://standardjs.com/) [](https://github.com/vesparny/brcast/blob/master/LICENSE) The current size of `brcast/dist/brcast.umd.min.js` is: [](https://unpkg.com/brcast/dist/) It's like a data store you can subscribe to, with a setter to pump data in. For browsers and node. ## Table of Contents - [Install](#install) - [Usage](#usage) - [Testing](#tests) - [License](#license) ## Install This project uses [node](http://nodejs.org) and [npm](https://npmjs.com). Go check them out if you don't have them locally installed. ```sh $ npm install --save brcast ``` Then with a module bundler like [rollup](http://rollupjs.org/) or [webpack](https://webpack.js.org/), use as you would anything else: ```javascript // using ES6 modules import brcast from 'brcast' // using CommonJS modules var brcast = require('brcast') ``` The [UMD](https://github.com/umdjs/umd) build is also available on [unpkg](https://unpkg.com): ```html ``` You can find the library on `window.brcast`. ## Usage ```js import brcast from 'brcast' let broadcast = brcast() // subscribe let unsubscribe = broadcast.subscribe(state => console.log(state)) // setState sets the state and invoke all subscription callbacks passing in the state broadcast.setState(1) // setState returns the current state broadcast.getState() // unsubscribe: invoke the function returned by broadcast.subscribe(state => console.log(state)) // to unbind the handler unsubscribe() ``` ## Tests ```sh $ npm run test ``` [MIT License](LICENSE.md) © [Alessandro Arnodo](https://alessandro.arnodo.net/)