This file contains hidden or 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
<html> | |
<head> | |
<title>Display Property</title> | |
<style> | |
#main{ | |
height: 100px; | |
width: 200px; | |
background: teal; | |
display: block; | |
This file contains hidden or 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
import { Meteor } from 'meteor/meteor'; | |
import { Mongo } from 'meteor/mongo'; | |
export const Teams = new Mongo.Collection('teams'); | |
if (Meteor.isServer) { | |
// This code only runs on the server | |
Meteor.publish('teams', function groupPublication() { | |
return Teams.find(); | |
}); |
This file contains hidden or 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
class todosContainer extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
loading: false, | |
todos: {} | |
} | |
} | |
createNewTodo(data){ | |
Meteor.call('todo.insert', data, function(err){ |
This file contains hidden or 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
getUserData() { | |
const id = Meteor.userId(); | |
if (id) { | |
const data = Meteor.users.findOne({ _id: id }); | |
if(data){ | |
console.log(data) | |
} | |
} | |
} | |
handleLogin(data) { |
This file contains hidden or 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 port = 3000 | |
require('http') | |
.createServer((req, res) => { | |
}) | |
.listen(port, (error)=>{ | |
console.log(`server is running on ${port}`) | |
}) |
This file contains hidden or 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 {rewireWorkboxInject, defaultInjectConfig} = require('react-app-rewire-workbox'); | |
const path = require('path'); | |
module.exports = function override(config, env) { | |
if (env === "production") { | |
console.log("Production build - Adding Workbox for PWAs"); | |
// Extend the default injection config with required swSrc | |
const workboxConfig = { | |
...defaultInjectConfig, | |
swSrc: path.join(__dirname, 'src', 'custom-sw.js') |
This file contains hidden or 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
{ | |
"name": "react-with-workbox", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"axios": "^0.19.0", | |
"eslint-config-prettier": "^6.1.0", | |
"prettier": "^1.18.2", | |
"react": "^16.4.2", | |
"react-app-rewire-workbox": "^2.0.1", |
This file contains hidden or 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
/* eslint-disable no-undef */ | |
// See https://developers.google.com/web/tools/workbox/guides/configure-workbox | |
workbox.core.setLogLevel(workbox.core.LOG_LEVELS.debug); | |
self.addEventListener('install', event => event.waitUntil(self.skipWaiting())); | |
self.addEventListener('activate', event => event.waitUntil(self.clients.claim())); | |
workbox.routing.registerRoute( | |
new RegExp('.css$'), | |
workbox.strategies.cacheFirst({ |
This file contains hidden or 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
export default function register() { | |
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { | |
// The URL constructor is available in all browsers that support SW. | |
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); | |
if (publicUrl.origin !== window.location.origin) { | |
// Our service worker won't work if PUBLIC_URL is on a different origin | |
// from what our page is served on. This might happen if a CDN is used to | |
// serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 | |
return; | |
} |