action

package
v1.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package action provides Action implementation for redux

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// Type help user recognize which signal they receive
	Type string
	// Args contain context of action, for example, login need account & password
	Args Args
}

Action is a type for reducer to know what should it do by recognize Action::Type

func New

func New(typ string) *Action

New create a new action and return a pointer to it.

Example:

action.New("Type")

func (*Action) Arg added in v0.5.1

func (act *Action) Arg(arg string, val interface{}) *Action

Arg help you append new Argument onto Action with fluent API

Example:

action.New("Type").
          Arg("author", "danny").
          Arg("age", 20)

type Args added in v1.4.0

type Args map[string]interface{}

Args help action define more flexible

Example:

act := action.Action {
    Type: "INC",
    Args: action.Args {
        "payload": 3,
    },
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL