Skip to content

Instantly share code, notes, and snippets.

Avatar

José Proença akaztp

View GitHub Profile
@akaztp
akaztp / article-web-app-architecture-based-on-redux-epic2-outline.md
Last active Sep 27, 2017
Epics outline for case study on article "Web app architecture based on Redux".
View article-web-app-architecture-based-on-redux-epic2-outline.md
  • React only on any action of types:
    • Selection of an entry. An entry was just selected so we should try to load its data.
    • User login success. Since an entry may be selected but not a user, only after the user is ok we can try to load the entry.
    • Page load. Similar to the user login check. Only on the correct page we can load the entry.
  • React only on these pre-condition:
    • Correct page id
    • user logged in
  • If current selected entry id is null:
    • Chain an action setting editing status to READY
  • Set editing data to empty
@akaztp
akaztp / article-web-app-architecture-based-on-redux-epic1-outline.md
Last active Sep 27, 2017
Epics outline for case study on article "Web app architecture based on Redux".
View article-web-app-architecture-based-on-redux-epic1-outline.md
  • React only on action of page entering with the correct page id
  • Check URL parameters to obtain the current entry id
  • Emit action for setting the current selected entry id in the state data
@akaztp
akaztp / article-web-app-architecture-based-on-redux-models.ts
Created Sep 27, 2017
Models for case study on article "Web app architecture based on Redux"
View article-web-app-architecture-based-on-redux-models.ts
class EntrySer {
constructor(
public id: string = null,
public title: string = '',
public type: string = 'FLICKR',
public data: string = '',
public postBy: UserRef = null,
public dateCreated: string = null) { }
public static fields: string = `
@akaztp
akaztp / match-obs.ts
Created Sep 27, 2017
An helper class to assert if an Observer produces the specified values.
View match-obs.ts
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import 'rxjs/add/operator/delay';
/**
* An helper class to assert if an Observer produces the specified values.
* It does not care about the time between values produced by the observer.
* Returns a promise that either completes if test passed ok, or reject with an error message if not.
* @param obs$ The observer to test.
* @param values The array of values to expect in the observable.