| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
|
| 6 |
<title>doc</title> |
| 7 |
<style> |
| 8 |
/*github.com style (c) Vasily Polovnyov <vast@whiteants.net>*/ |
| 9 |
pre code { |
| 10 |
display: block; padding: 0.5em; |
| 11 |
color: #333; |
| 12 |
background: #f8f8ff |
| 13 |
} |
| 14 |
pre .comment, |
| 15 |
pre .template_comment, |
| 16 |
pre .diff .header, |
| 17 |
pre .javadoc { |
| 18 |
color: #998; |
| 19 |
font-style: italic |
| 20 |
} |
| 21 |
pre .keyword, |
| 22 |
pre .css .rule .keyword, |
| 23 |
pre .winutils, |
| 24 |
pre .javascript .title, |
| 25 |
pre .nginx .title, |
| 26 |
pre .subst, |
| 27 |
pre .request, |
| 28 |
pre .status { |
| 29 |
color: #333; |
| 30 |
font-weight: bold |
| 31 |
} |
| 32 |
pre .number, |
| 33 |
pre .hexcolor, |
| 34 |
pre .ruby .constant { |
| 35 |
color: #099; |
| 36 |
} |
| 37 |
pre .string, |
| 38 |
pre .tag .value, |
| 39 |
pre .phpdoc, |
| 40 |
pre .tex .formula { |
| 41 |
color: #d14 |
| 42 |
} |
| 43 |
pre .title, |
| 44 |
pre .id { |
| 45 |
color: #900; |
| 46 |
font-weight: bold |
| 47 |
} |
| 48 |
pre .javascript .title, |
| 49 |
pre .lisp .title, |
| 50 |
pre .clojure .title, |
| 51 |
pre .subst { |
| 52 |
font-weight: normal |
| 53 |
} |
| 54 |
pre .class .title, |
| 55 |
pre .haskell .type, |
| 56 |
pre .vhdl .literal, |
| 57 |
pre .tex .command { |
| 58 |
color: #458; |
| 59 |
font-weight: bold |
| 60 |
} |
| 61 |
pre .tag, |
| 62 |
pre .tag .title, |
| 63 |
pre .rules .property, |
| 64 |
pre .django .tag .keyword { |
| 65 |
color: #000080; |
| 66 |
font-weight: normal |
| 67 |
} |
| 68 |
pre .attribute, |
| 69 |
pre .variable, |
| 70 |
pre .lisp .body { |
| 71 |
color: #008080 |
| 72 |
} |
| 73 |
pre .regexp { |
| 74 |
color: #009926 |
| 75 |
} |
| 76 |
pre .class { |
| 77 |
color: #458; |
| 78 |
font-weight: bold |
| 79 |
} |
| 80 |
pre .symbol, |
| 81 |
pre .ruby .symbol .string, |
| 82 |
pre .lisp .keyword, |
| 83 |
pre .tex .special, |
| 84 |
pre .prompt { |
| 85 |
color: #990073 |
| 86 |
} |
| 87 |
pre .built_in, |
| 88 |
pre .lisp .title, |
| 89 |
pre .clojure .built_in { |
| 90 |
color: #0086b3 |
| 91 |
} |
| 92 |
pre .preprocessor, |
| 93 |
pre .pi, |
| 94 |
pre .doctype, |
| 95 |
pre .shebang, |
| 96 |
pre .cdata { |
| 97 |
color: #999; |
| 98 |
font-weight: bold |
| 99 |
} |
| 100 |
pre .deletion { |
| 101 |
background: #fdd |
| 102 |
} |
| 103 |
pre .addition { |
| 104 |
background: #dfd |
| 105 |
} |
| 106 |
pre .diff .change { |
| 107 |
background: #0086b3 |
| 108 |
} |
| 109 |
pre .chunk { |
| 110 |
color: #aaa |
| 111 |
} |
| 112 |
</style> |
| 113 |
</head> |
| 114 |
<body> |
| 115 |
<h2 id="storage-usage">Storage Usage</h2> |
| 116 |
<p>Storage module is developed for client-side persistant storing of key & value pairs.</p> |
| 117 |
<pre><code class="lang-javascript"> |
| 118 |
// Initialize Storage. |
| 119 |
var Storage = require( 'udx.storage' ).create(); |
| 120 |
|
| 121 |
// Set some values. |
| 122 |
Storage.setItem( 'name', 'Andy' ); |
| 123 |
Storage.setItem( 'latitude', '34.4239' ); |
| 124 |
Storage.setItem( 'longitude', '-77.5584' ); |
| 125 |
|
| 126 |
// Later... |
| 127 |
console.log( 'Welcome', Storage.getItem( 'name' ), 'we have you located at', Storage.getItem( 'latitude' ), ', ', Storage.getItem( 'longitude' ) );</code></pre> |
| 128 |
<p>Storage attempts to save data into localStorage, if the browser supports it. Otherwise we fallback to Cookie storage.</p> |
| 129 |
<h2 id="settings-usage">Settings Usage</h2> |
| 130 |
<pre><code class="lang-php">// Instantiate and load Settings. |
| 131 |
$settings = new Settings(array( |
| 132 |
"store" => "options", |
| 133 |
"key" => "settings_test", |
| 134 |
"format" => "object", |
| 135 |
"auto_commit" => true, |
| 136 |
"data" => array( 'initial data', 'blah' ) |
| 137 |
)); |
| 138 |
|
| 139 |
$settings->set( 'make', 'Chevy' ); |
| 140 |
$settings->set( 'model', 'Tahoe' ); |
| 141 |
|
| 142 |
$settings->set( 'features', array( |
| 143 |
'ac', |
| 144 |
'stuff' |
| 145 |
'dvd', |
| 146 |
'sunroof' |
| 147 |
)); |
| 148 |
|
| 149 |
$settings->set( 'options', array( |
| 150 |
"gps" => 'standard', |
| 151 |
"rims" => '24', |
| 152 |
"towing" => true, |
| 153 |
"onstar" => 'active' |
| 154 |
));</code></pre> |
| 155 |
<pre><code class="lang-php">// Initialize Settings. |
| 156 |
$this->_settings = new Settings(array( |
| 157 |
"store" => "options", |
| 158 |
"key" => "ud:veneer", |
| 159 |
)); |
| 160 |
|
| 161 |
// ElasticSearch Service Settings. |
| 162 |
$this->set( 'documents', array( |
| 163 |
"host" => "localhost", |
| 164 |
"active" => true, |
| 165 |
"token" => "alsdkjflaksdjsadsdff", |
| 166 |
"port" => 9200 |
| 167 |
)); |
| 168 |
|
| 169 |
// Varnish Service Settings. |
| 170 |
$this->set( 'varnish', array( |
| 171 |
"host" => "localhost", |
| 172 |
"active" => false |
| 173 |
)); |
| 174 |
|
| 175 |
// CDN Service Settings. |
| 176 |
$this->set( 'cdn', array( |
| 177 |
"active" => true, |
| 178 |
"provider" => "gcs", |
| 179 |
"subdomain" => "media", |
| 180 |
"key" => "alsdkjflaksdjf" |
| 181 |
)); |
| 182 |
|
| 183 |
// Save Settings. |
| 184 |
$this->_settings->commit();</code></pre> |
| 185 |
<h2 id="license">License</h2> |
| 186 |
<p>(The MIT License)</p> |
| 187 |
<p>Copyright (c) 2013 Usability Dynamics, Inc. <info@usabilitydynamics.com></p> |
| 188 |
<p>Permission is hereby granted, free of charge, to any person obtaining |
| 189 |
a copy of this software and associated documentation files (the |
| 190 |
'Software'), to deal in the Software without restriction, including |
| 191 |
without limitation the rights to use, copy, modify, merge, publish, |
| 192 |
distribute, sublicense, and/or sell copies of the Software, and to |
| 193 |
permit persons to whom the Software is furnished to do so, subject to |
| 194 |
the following conditions:</p> |
| 195 |
<p>The above copyright notice and this permission notice shall be |
| 196 |
included in all copies or substantial portions of the Software.</p> |
| 197 |
<p>THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
| 198 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 199 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 200 |
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 201 |
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 202 |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 203 |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> |
| 204 |
|
| 205 |
</body> |
| 206 |
</html> |
| 207 |
|