Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import "whatwg-fetch";
import fetchPonyfill from "fetch-ponyfill";
import ReactDOM from "react-dom";
import {BrowserRouter} from "react-router-dom";
import {render} from "./router";
import {Trimet} from "./data";
import {store} from "./store";
const trimet = new Trimet(store, fetchPonyfill().fetch);
trimet.start();
window.addEventListener("load", () => {
ReactDOM.render(
render(store, trimet.handleStopChange, {Router: BrowserRouter}),
document.getElementById("app")
);
});
import React from 'react'
import PropTypes from 'prop-types'
import CopyToClipboard from 'react-copy-to-clipboard'
import JSONPretty from 'react-json-pretty'
import Button from 'react-bootstrap/lib/Button'
import Modal from 'react-bootstrap/lib/Modal'
import NewWindowIcon from '../shared/NewWindowIcon'
import {withSpinner} from '../shared/Spinner'
import FetchPonyfill from 'fetch-ponyfill'
const fetch = FetchPonyfill().fetch
/**
* Button that reveals a backend resouce at 'url' when clicked.
*
* Used to show the underlying JSON that a view was rendered with OR for
* showing a related resource, eg. an anchor's server.toml file.
*/
const BackendResourceBadgeButton = ({handleClickFn, label, url}) => (
<a href="{url}">
{label}
</a>
)
import { Promise } from 'es6-promise'
import fetchPonyfill from 'fetch-ponyfill'
import { vsprintf } from 'sprintf-js'
import formatText from './format_text'
import stringifyAsQueryParam from './stringify_as_query_param'
const fetch = fetchPonyfill(Promise)
/**
* imported from https://github.com/bigchaindb/js-utility-belt/
*
* Global fetch wrapper that adds some basic error handling and ease of use enhancements.
* Considers any non-2xx response as an error.
*
* For more information on fetch, see https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch.
*
* Expects fetch to already be available (either in a ES6 environment, bundled through webpack, or
* injected through a polyfill).
*
* @param {string} url Url to request. Can be specified as a sprintf format string (see
* https://github.com/alexei/sprintf.js) that will be resolved using
* `config.urlTemplateSpec`.
import React from 'react'
import PropTypes from 'prop-types'
import FetchPonyfill from 'fetch-ponyfill'
const fetch = FetchPonyfill().fetch
const FEED_URL = 'https://api.coinmarketcap.com/v1/ticker/stellar/'
const UPDATE_INTERVAL = 5 * 60 * 1000
class LumensRatesContainer extends React.PureComponent {
componentDidMount() {
this.updatePrice()
this.intervalId = setInterval(
() => this.updatePrice.bind(this),
UPDATE_INTERVAL
)
}
componentWillUnmount() {
clearInterval(this.intervalId)
}
* index.js
*
* changelog
* 2016-09-08[09:07:10]:revised
*
* @author yanni4night@gmail.com
* @version 0.1.0
* @since 0.1.0
*/
'use strict';
import * as ACTION_TYPES from '../constant/action-types';
import {push, goBack} from 'react-router-redux';
import fetchPonyfill from 'fetch-ponyfill';
import Promise from 'bluebird';
const {fetch} = fetchPonyfill(Promise);
export const loadHot = () => {
return (dispatch, getState) => {
const state = getState();
if (state.hot && state.hot.length) {
return;
} else {
fetch('/api/topics/hot.json', {
mode: 'no-cors',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(response => response.json()).then(hot => {
dispatch({
type: ACTION_TYPES.ACTION_LOAD_HOT,