v1.0
28/10/2014
v1.1
31/03/2015
windows
v1.2
21/09/2015
Galaxy, es6, react, angular
v1.3
28/03/2016
Npm, module es6
v1.4
xx/xx/xxxx
core split to npm, apolloStack
Par @nicooprat
Par @rebolon
Un exemple ?
npm install asteroid asteroid-immutable-collections-mixin immutable
...
import {createClass} from "asteroid";
import immutableCollectionMixin from "asteroid-immutable-collections-mixin";
const Asteroid = createClass([immutableCollectionMixin]);
// Connect to a Meteor backend
const asteroid = new Asteroid({
endpoint: "ws://localhost:3008/websocket" // use config
});
// Call a method
let params = [1, 2];
asteroid.call('myMethod', params)
.then((res) => {
console.info('response ok');
})
.catch((err) => {
console.warn(err);
});
// login (manage auto-reconnection)
asteroid.loginWithPassword({"email": login, "password": password})
.then(res => {
console.info("loginWithPassword", res);
})
.catch(error => {
console.error("loginWithPassword Error", error);
});
asteroid.on("loggedIn", () => {
console.info("loggedIn sent from asteroid");
});
asteroid.on("loggedOut", () => {
console.info("Loggedout sent from asteroid");
});
asteroid.ddp.on("connected", () => {
console.info('connected to server');
});
// subscribe
let subscription = asteroid.subscribe("your-publication-key");
let myCollection;
subscriptionon('ready', () => {
myCollection = asteroid.collections.get("your-collection-store");
});
Des questions ?