Skip to content

Commit

Permalink
feat(domain): Ability to set the domain that the library pings
Browse files Browse the repository at this point in the history
YOu can override the domain that this library pings for testing purposes
  • Loading branch information
mmmoli committed Jan 26, 2016
1 parent df80216 commit 13f7051
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import {Observable} from 'rx-lite';
import fetchJsonp from 'fetch-jsonp';
import {resolve, parse} from 'url';

const getStream = (collectionId, intervalSeconds = 8) => {
const getStream = (
collectionId,
intervalSeconds = 8,
domain = 'http://app.climb.social'
) => {

if (!collectionId) {
throw new Error('Please specify a collectionId');
Expand All @@ -17,7 +22,9 @@ const getStream = (collectionId, intervalSeconds = 8) => {

const pollRate = intervalSeconds * 1000;

const requestStream = Observable.just(`http://app.climb.social/api/v1/collections/${collectionId}`);
const URL = resolve(domain, `/api/v1/collections/${collectionId}`);

const requestStream = Observable.just(URL);

const updateStream = Observable.interval(pollRate).startWith(null);

Expand Down

0 comments on commit 13f7051

Please sign in to comment.