2020-05-10 04:24:46 -07:00
|
|
|
import { api } from '/api';
|
|
|
|
import { store } from '/store';
|
|
|
|
|
|
|
|
import urbitOb from 'urbit-ob';
|
|
|
|
|
|
|
|
|
|
|
|
export class Subscription {
|
|
|
|
start() {
|
|
|
|
if (api.authTokens) {
|
2020-05-10 04:30:23 -07:00
|
|
|
// this.initializebarttile();
|
2020-05-10 04:24:46 -07:00
|
|
|
} else {
|
|
|
|
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-10 04:30:23 -07:00
|
|
|
// initializebarttile() {
|
|
|
|
// api.bind('/primary', 'PUT', api.authTokens.ship, 'barttile',
|
2020-05-10 04:24:46 -07:00
|
|
|
// this.handleEvent.bind(this),
|
|
|
|
// this.handleError.bind(this));
|
|
|
|
// }
|
|
|
|
|
|
|
|
handleEvent(diff) {
|
|
|
|
store.handleEvent(diff);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleError(err) {
|
|
|
|
console.error(err);
|
2020-05-10 04:30:23 -07:00
|
|
|
api.bind('/primary', 'PUT', api.authTokens.ship, 'barttile',
|
2020-05-10 04:24:46 -07:00
|
|
|
this.handleEvent.bind(this),
|
|
|
|
this.handleError.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export let subscription = new Subscription();
|