35 lines
772 B
JavaScript
35 lines
772 B
JavaScript
import { api } from '/api';
|
|
import { store } from '/store';
|
|
|
|
import urbitOb from 'urbit-ob';
|
|
|
|
|
|
export class Subscription {
|
|
start() {
|
|
if (api.authTokens) {
|
|
// this.initializebarttile();
|
|
} else {
|
|
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
|
|
}
|
|
}
|
|
|
|
// initializebarttile() {
|
|
// api.bind('/primary', 'PUT', api.authTokens.ship, 'barttile',
|
|
// this.handleEvent.bind(this),
|
|
// this.handleError.bind(this));
|
|
// }
|
|
|
|
handleEvent(diff) {
|
|
store.handleEvent(diff);
|
|
}
|
|
|
|
handleError(err) {
|
|
console.error(err);
|
|
api.bind('/primary', 'PUT', api.authTokens.ship, 'barttile',
|
|
this.handleEvent.bind(this),
|
|
this.handleError.bind(this));
|
|
}
|
|
}
|
|
|
|
export let subscription = new Subscription();
|