Comparing version 0.8.0 to 0.8.1
{ | ||
"name": "marty", | ||
"main": "dist/marty.js", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"homepage": "martyjs.org", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -428,2 +428,24 @@ --- | ||
<h2 id="hasAlreadyFetched">hasAlreadyFetched(fetchId)</h2> | ||
For when you want to know if you have already tried fetching something. Given a fetch Id it will return true or false depending on whether you have previously tried a fetch for that Id (Irrelevant of whether it was successful or not). Useful if you want to distinguish between an empty collection and needing to fetch state from a remote source. | ||
{% highlight js %} | ||
var UsersStore = Marty.createStore({ | ||
getUsers: function () { | ||
return this.fetch( | ||
id: 'users', | ||
locally: function () { | ||
if (this.hasAlreadyFetched('users')) { | ||
return this.state; | ||
} | ||
}, | ||
remotely: function () { | ||
return UsersHttpAPI.getAll() | ||
} | ||
}) | ||
} | ||
}); | ||
{% endhighlight %} | ||
<h2 id="waitFor">waitFor(*stores)</h2> | ||
@@ -430,0 +452,0 @@ |
@@ -10,3 +10,3 @@ --- | ||
<p class="lead"> | ||
Helping you build Flux applications with React | ||
A Javascript library for state management in React applications | ||
</p> | ||
@@ -18,17 +18,23 @@ <p class="lead"> | ||
</div> | ||
<!-- <div class="container bs-docs-marketing"> | ||
<div class="container bs-docs-marketing"> | ||
<div class="row"> | ||
<div class="col-sm-6"> | ||
<div class="col-sm-4"> | ||
<h3>Flux</h3> | ||
<p> | ||
<a href="http://facebook.github.io/flux/docs/overview.html">Flux</a> is the application architecture that Facebook uses for building client-side web applications. marty.js gives you everything you need to quickly build a flux application. | ||
Marty is an implementation of the <a href="http://facebook.github.io/flux/docs/overview.html">Flux architecture</a>. It defines a set of rules about how to manage your applications state. Facebook invented Flux to help them build client-side web applications. | ||
</p> | ||
</div> | ||
<div class="col-sm-6"> | ||
<div class="col-sm-4"> | ||
<h3>State management</h3> | ||
<p> | ||
Marty provides solutions for <a href="/guides/state-sources/index.html">getting state into your application</a>, <a href="/guides/stores/index.html">storing it in memory</a> and then <a href="/guides/state-mixin/index.html">binding it to your react components</a> | ||
</p> | ||
</div> | ||
<div class="col-sm-4"> | ||
<h3>Debugging</h3> | ||
<p> | ||
We have advanced developer tools that make it easy to under stand what your application is doing at all times. | ||
Marty has a <a href="/devtools/">Chrome Developer tool</a> to help you visualize the current state is in your application and how it changes over time. | ||
</p> | ||
</div> | ||
</div> | ||
</div> --> | ||
</div> |
@@ -7,3 +7,3 @@ var _ = require('underscore'); | ||
var Marty = _.extend({ | ||
version: '0.8.0', | ||
version: '0.8.1', | ||
Dispatcher: Dispatcher.getCurrent() | ||
@@ -10,0 +10,0 @@ }, state, create); |
@@ -22,4 +22,5 @@ var CHANGE_EVENT = 'changed'; | ||
var store = this; | ||
var defaultState = {}; | ||
var fetchHistory = {}; | ||
var failedFetches = {}; | ||
var defaultState = {}; | ||
var fetchInProgress = {}; | ||
@@ -39,2 +40,3 @@ var emitter = new EventEmitter(); | ||
this.handleAction = handleAction; | ||
this.hasAlreadyFetched = hasAlreadyFetched; | ||
this.addChangeListener = addChangeListener; | ||
@@ -119,2 +121,6 @@ | ||
function hasAlreadyFetched(fetchId) { | ||
return !!fetchHistory[fetchId]; | ||
} | ||
function fetchState(id, local, remote) { | ||
@@ -164,6 +170,7 @@ var options, result, error, cacheError; | ||
if (result) { | ||
finished(); | ||
return fetchResult.done(result); | ||
} | ||
} catch (error) { | ||
failedFetches[options.id] = error; | ||
failed(error); | ||
@@ -186,3 +193,3 @@ return fetchResult.failed(error); | ||
if (result) { | ||
fetchFinished(); | ||
finished(); | ||
hasChanged(); | ||
@@ -214,3 +221,4 @@ } else { | ||
function fetchFinished() { | ||
function finished() { | ||
fetchHistory[options.id] = true; | ||
delete fetchInProgress[options.id]; | ||
@@ -224,3 +232,3 @@ } | ||
fetchFinished(); | ||
finished(); | ||
@@ -227,0 +235,0 @@ return fetchResult.failed(error); |
{ | ||
"name": "marty", | ||
"version": "0.8.0", | ||
"description": "A React.js/Flux Framework", | ||
"version": "0.8.1", | ||
"description": "A Javascript library for state management in React applications", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
[![Build Status](https://travis-ci.org/jhollingworth/marty.svg?branch=master)](https://travis-ci.org/jhollingworth/marty) | ||
[Marty](http://martyjs.org) is a Javascript library for state management in React applications. It is an implementation of the [Flux architecture](http://facebook.github.io/flux/docs/overview.html). | ||
[Marty](http://martyjs.org) helps you build web applications that follow the [Flux architecture](http://facebook.github.io/flux/docs/overview.html). | ||
## Quick start | ||
@@ -50,3 +49,2 @@ | ||
## Maintainers | ||
@@ -53,0 +51,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3161577
135
23884
60