Help us understand the problem. What is going on with this article?

cortex.js: 監視可能なネストできるオブジェクト

More than 5 years have passed since last update.

mquan/cortex

副作用が加えられるとコールバックを発火するオブジェクトを作れる。ネストしたオブジェクトもとれる。

Vue.jsの$dataを知っている人は、getter/setterが専用に置き換えられたそれだと思えばよい。逆に言えばそれだけしかしないのだが。

何に使うの

JSのMVW用のミドルウェア。README見る限り、Reactと一緒に使うのを想定しているが、APIを見る限り、別にそれに限ったものでもない。役割はモデル層だけに限定される。

とはいえ、ViewModel的に使うのが一番適していると思われる。

使い方

var Cotex = require('cortexjs');
var c = new Cortex({a:1, b: [1], c: {d: 2}});
c.on('update', function(c){
  console.log('updated', c.val());
});

c.a.val() //=> 1
c.b.push(2); //=> modified and fire
c.c.d.set(3);//=> modified and fire

plaid
CXプラットフォーム「KARTE」の開発・運営、EC特化型メディア「Shopping Tribe」の企画・運営、CX特化型メディア「XD(クロスディー)」の企画・運営
https://plaid.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした