0.0.1 • Published 7 years ago

ion2-store v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Store Module

This is a ngrx store module for Ionic2. Supports Angular's ngc and Ahead-of-Time compiling out of the box.

Developing

Develop your module like any other Angular 2 module. Then, run npm run build to build a local copy.

When you're ready to publish to npm, run npm run publishPackage.

If you'd like to test this package, run npm install ion2-store

npm link

Currently, modules must be published to npm. npm link packages will not install properly with our webpack confing (something on our list). If you can't push private code to npm, other options are a private npm repo/npm enterprise, or npm install from a git repo.

Using on action

Update your-action.ts:

import { applyMixins, BaseAction } from 'ion2-store';

export class ClaimAction implements BaseAction {
	childAddedType: string;
	childChangedType: string;
	childRemovedType: string;
	createType: string;
	deleteType: string;
	loadType: string;
	selectType: string;
	updateType: string;

	constructor() {
		this.childAddedType = ClaimAction.CHILD_ADDED;
		this.childChangedType = ClaimAction.CHILD_CHANGED;
		this.childRemovedType = ClaimAction.CHILD_REMOVED;
		this.createType = ClaimAction.CREATE;
		this.deleteType = ClaimAction.DELETE;
		this.loadType = ClaimAction.LOAD;
		this.selectType = ClaimAction.SELECT;
		this.updateType = ClaimAction.UPDATE;
	}

	static CHILD_ADDED = 'CLAIM_CHILD_ADDED';
	childAdded: (claim: Claim) => Action;

	static CHILD_CHANGED = 'CLAIM_CHILD_CHANGED';
	childChanged: (claim: Claim) => Action;

	static CHILD_REMOVED = 'CLAIM_CHILD_REMOVED';
	childRemoved: (claim: Claim) => Action;

	static CREATE = 'CLAIM_CREATE';
	create: (claim: Claim) => Action;

	static DELETE = 'CLAIM_DELETE';
	delete: (claim: Claim) => Action;

	static LOAD = 'CLAIM_LOAD';
	load: (tenantKey: string) => Action;

	static SELECT = 'CLAIM_SELECT';
	select: (claim) => Action;

	static UPDATE = 'CLAIM_UPDATE';
	update: (claim: Claim) => Action;
}
applyMixins(ClaimAction, [BaseAction]);