├── .gitignore ├── LICENSE ├── README.md ├── bower.json ├── dist ├── react-storage.js └── react-storage.min.js ├── example ├── dist │ ├── JSXTransformer.js │ ├── app.js │ ├── bundle.js │ ├── codemirror.css │ ├── codemirror.js │ ├── common.js │ ├── index.html │ └── javascript.js └── src │ ├── app.js │ └── index.html ├── gulpfile.js ├── package.json └── src └── Storage.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Coverage tools 11 | lib-cov 12 | coverage 13 | 14 | # Compiled binary addons (http://nodejs.org/api/addons.html) 15 | build/Release 16 | 17 | # Dependency directory 18 | node_modules 19 | .idea 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Yuanyan Cao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | React Storage 2 | ============== 3 | 4 | Storage Component for React. 5 | 6 | ## Demo & Examples 7 | 8 | Live demo: [yuanyan.github.io/react-image](http://yuanyan.github.io/react-storage/) 9 | 10 | To build the examples locally, run: 11 | 12 | ``` 13 | npm install 14 | gulp dev 15 | ``` 16 | 17 | Then open [`localhost:9999`](http://localhost:9999) in a browser. 18 | 19 | ## Installation 20 | 21 | The easiest way to use `react-storage` is to install it from NPM and include it in your own React build process (using [Browserify](http://browserify.org), etc). 22 | 23 | You can also use the standalone build by including `dist/react-storage.js` in your page. If you use this, make sure you have already included React, and it is available as a global variable. 24 | 25 | ``` 26 | npm install react-storage --save 27 | ``` 28 | 29 | ## Usage 30 | 31 | ``` 32 | var React = require('react'); 33 | var Storage = require('react-storage'); 34 | var App = React.createClass({ 35 | 36 | render: function() { 37 | return ( 38 | 39 | ); 40 | } 41 | 42 | }); 43 | ``` 44 | 45 | ## Properties 46 | 47 | Attribute | Options | Default | Description 48 | --- | --- | --- | --- 49 | `name` | *string* | `null` | The key to the data stored in localforage. 50 | `value` | *string* | `null` | The data associated with the specified name. 51 | `useRaw` | *boolean* | `false` | If true, the value is stored and retrieved without JSON processing. 52 | `autoSave` | *boolean* | `true` | If false, auto save is disabled. 53 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-mq", 3 | "main": "dist/react-mq.min.js", 4 | "version": "0.1.0", 5 | "homepage": "https://github.com/yuanyan/react-mq", 6 | "authors": [ 7 | "Yuanyan Cao" 8 | ], 9 | "description": "Media Query Component for React", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "react", 17 | "react-component", 18 | "media", 19 | "media query" 20 | ], 21 | "license": "MIT", 22 | "ignore": [ 23 | ".editorconfig", 24 | ".gitignore", 25 | "package.json", 26 | "src", 27 | "node_modules", 28 | "example", 29 | "test" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /dist/react-storage.js: -------------------------------------------------------------------------------- 1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Storage=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o