This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require('react'); | |
const PropTypes = React.PropTypes; | |
const { connect } = require('react-redux'); | |
const Modal = require('react-modal'); | |
const { closeModal } = require('actions/modal'); | |
const MODAL_STYLE = { | |
content: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PRECACHE = 'precache-v1'; | |
const RUNTIME = 'runtime'; | |
// A list of local resources we always want to be cached. | |
const PRECACHE_URLS = [ | |
'index.html', | |
'./', // Alias for index.html | |
'styles.css', | |
'../../styles/main.css', | |
'demo.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeServiceWorkerEnv = require('service-worker-mock'); | |
describe('Service worker', () => { | |
beforeEach(() => { | |
Object.assign(global, makeServiceWorkerEnv()); | |
jest.resetModules(); | |
}); | |
// ... | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeServiceWorkerEnv = require('service-worker-mock'); | |
describe('Service worker', () => { | |
beforeEach(() => { | |
Object.assign(global, makeServiceWorkerEnv()); | |
jest.resetModules(); | |
}); | |
it('should delete old caches on activate', async () => { | |
require('../sw.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeServiceWorkerEnv = require('service-worker-mock'); | |
const Response = () => ({ clone: jest.fn() }); | |
const Request = () => ({ url: '/test' }); | |
describe('Service worker', () => { | |
beforeEach(() => { | |
Object.assign(global, makeServiceWorkerEnv()); | |
jest.resetModules(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
caches: { | |
CACHE_V1: {} | |
}, | |
clients: [], | |
notifications: [], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
<DeferredMount ssr /> | |
This component defers rendering of its children until after mounting, good | |
for below-the-fold content. If the content should be rendered syncronously | |
on the server you can set the `ssr` prop. If `ssr` is set to true, there | |
will be a client/server mismatch unless you can somehow determine that we | |
are hydrating from the server. | |
Is there a better way than the hack below? | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Props = { | |
match: { params: { username: string } }, | |
resource: { fetching: boolean }, | |
user: User, | |
}; | |
export default withResource({ | |
name: 'UserResource', | |
key: 'resource', | |
options: ({ match }: Props) => ({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Homefeed = createFeed({ | |
feedKey: 'homefeed', | |
resourceName: 'UserHomefeedResource', | |
resourceOptions: () => ({ | |
field_set_key: 'mobile_grid_item', | |
}), | |
pullToRefresh: true, | |
}); | |
const HomePage = (props: Props) => ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a loader | |
const Closeup = () => import(/* webpackChunkName: "CloseupPage" */ 'app/mobile/routes/CloseupPage'); | |
// Register it to the route | |
route('/pin/:pinId', routes.Closeup, { name: 'Closeup' }), | |
// Render a react-router-v4 Route with the route bundle loader | |
<Route exact key="matched-route" path={path} render={matchProps => | |
<PageRoute | |
bundleLoader={loader} |
OlderNewer