Skip to content

Instantly share code, notes, and snippets.

View quoctrungdh's full-sized avatar

Quoc Trung Do Ha quoctrungdh

  • Ho Chi Minh city
View GitHub Profile
@quoctrungdh
quoctrungdh / Project-Branch.git
Created May 14, 2020 15:42
Mobx State dependency model
// FROM: https://dataform.co/blog/how-we-use-mobx-to-solve-our-frontend-state
// https://assets.dataform.co/blog/archive/mobx_store.png
import {action, computed, observable, runInAction} from 'mobx';
import Loadable from './loadable';
export default class Loadable<T> {
// our state entity class
public static create<T>(val?: T) {
{"v":"5.1.20","fr":60,"ip":0,"op":119,"w":800,"h":800,"nm":"Store","ddd":0,"assets":[{"id":"image_0","w":500,"h":500,"u":"images/","p":"img_0.png","e":0},{"id":"image_1","w":1648,"h":2928,"u":"images/","p":"img_1.jpg","e":0},{"id":"image_2","w":322,"h":604,"u":"images/","p":"img_2.png","e":0},{"id":"image_3","w":1512,"h":2766,"u":"images/","p":"img_3.png","e":0},{"id":"image_4","w":500,"h":500,"u":"images/","p":"img_4.png","e":0},{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Layer 5 Outlines","parent":3,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.654],"y":[0]},"n":["0p667_1_0p654_0"],"t":9,"s":[0],"e":[-3]},{"i":{"x":[0.344],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p344_1_0p333_0"],"t":30,"s":[-3],"e":[0]},{"t":50.525390625}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.656,"y":0},"n":"0p667_1_0p656_0","t":9.125,"s":[77.592,0.753,0],"e":[74.527,-9.779,0],"to":[-0.51090842485428,-1.75538313388824,0],"ti":[0,0,0]},{"i":{"x":0.344,"y":1}
// Credit: https://frontstuff.io/build-a-simple-validator-service-in-javascript
// Define validator
const Validator = function() {};
Validator.prototype.isString = function(value) {
if (typeof value === 'string') {
return true;
}