2.7.0 โ€ข Published 4 months ago

act-master v2.7.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 months ago

Act-Master

A way to separate business logic from application view.

The easiest library to create a flexible application architecture.

npm bundle size npm version

To work with Vue, there are now even fewer dependencies. Just use act-mater.


๐Ÿ“— Documentation

๐Ÿงช Test writing with "ActTest"


Example

Installation

npm install act-master

Usage

// main.ts
import { act } from 'act-master';
import { VueActMaster } from 'act-master/vue';
import { createApp } from 'vue';

import { actions } from '@/act/actions';

act.init({
  actions,
});

VueActMaster.setActMaster(act());

const app = createApp(App);

app.use(VueActMaster); // Installation
// @/act/actions
export const actions: ActMasterAction[] = [
  new GetDataAction(),
];
// action-get-data.ts
import { ActMasterAction } from 'vue-act-master';

export class GetDataAction implements ActMasterAction {
  name = 'GetData';

  async exec() {
    const url = 'https://jsonplaceholder.typicode.com/todos/1';

    const response = await fetch(url);
    return response.json();
  }
}

The action is now available to you in components and you can easily highlight the business logic.

This will help you test components and change the API more easily.

// App.vue

<script>
import { act } from 'act-master'

export default {
  data() {
    return {
      myData1: null,
      myData2: null,
    };
  },

  async mounted() {
    console.log(this.myData1, this.myData2); // null, null

    // Subscribe
    act().on('GetData', (data) => {
      this.myData2 = data;
    });

    this.myData1 = await this.$act.exec('GetData');

    console.log(this.myData1, this.myData2);
    // {
    //   "userId": 1,
    //   "id": 1,
    //   "title": "delectus aut autem",
    //   "completed": false
    // },
    // {
    //   "userId": 1,
    //   "id": 1,
    //   "title": "delectus aut autem",
    //   "completed": false
    // }
  }
}
</script>
2.7.0

4 months ago

2.6.0

9 months ago

2.5.2

12 months ago

2.5.1

12 months ago

2.5.0

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

2.3.9

1 year ago

2.2.1

2 years ago

2.0.3

2 years ago

2.2.0

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

3.0.0-beta-01

2 years ago

3.0.0-beta-02

2 years ago

3.0.0-beta-03

2 years ago

3.0.0-beta-04

2 years ago

2.3.8

2 years ago

2.3.7

2 years ago

2.3.0

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.1.3

2 years ago

2.3.4

2 years ago

2.3.3

2 years ago

2.3.6

2 years ago

2.3.5

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.11.4

3 years ago

1.11.3

3 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.10.8

3 years ago

1.10.7

3 years ago

1.11.5

3 years ago

1.10.6

3 years ago

1.11.0

3 years ago

1.10.5

3 years ago

1.10.4

4 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.9.0

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.3

5 years ago

1.0.0

5 years ago