besports / goldmine-client Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU Lesser General Public License v3.0
License: GNU Lesser General Public License v3.0
Code for my container
import { createContainer } from 'goldmine-client';
import _ from 'lodash';
import Root from './Root';
import UserStore from '../UserStore';
export default createContainer(component => {
const userId = localStorage.userId;
UserStore.setUserId(userId);
component.subscribe('userForUserId', { userId }, true);
console.log('update');
return {
user: _.find(component.getCollection('users'), ['_id', userId]),
};
}, Root);
Update is noticed by the goldmine-client thought, as I get in my console
Object {type: "update", collectionName: "users", data: Object}
Add an optional param to convert all gets from the collection to mobx.toJS, if this keeps the same performance only.
<GoldMine
subscriptions={[
{
name: 'subName',
props: {},
isReactive: true,
single: true,
},
]}
component={Component}
/>
Sometimes it is expected that a publication will ALWAYS return 1 result. In order to prevent having to set const result = _.first(this.data.collection)
, make it available as an object straight away.
change it to component.subcribe('pubName', !!reactive, params) to allow empty params if none are needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.