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
Posts = new Mongo.Collection('posts'); | |
Meteor.methods({ | |
'addPost': function() { | |
Posts.insert({title: 'Post ' + Random.id()}); | |
}, | |
'deletePost': function() { | |
let post = Posts.findOne(); | |
if (post) { |
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
Meteor.startup(function() { | |
if (Posts.find().count() === 0) { | |
for (i = 1; i <= 10; i++) { | |
Posts.insert({title: 'Post ' + Random.id()}); | |
} | |
} | |
}); | |
Meteor.publish('posts', function() { | |
return Posts.find(); |
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
<template name="home"> | |
<h1>Post Count: {{count}}</h1> | |
<button id="increment">Increment</button> | |
<button id="decrement">Decrement</button> | |
</template> |
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
Template.home.onCreated(function() { | |
this.subscribe('posts'); | |
}); | |
Template.home.helpers({ | |
count() { | |
return Posts.find().count(); | |
} | |
}); |
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
<head> | |
<title>meteor-app</title> | |
</head> | |
<body> | |
{{> home}} | |
</body> |
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
import React, { | |
View, | |
Text, | |
StyleSheet | |
} from 'react-native'; | |
import Button from './button'; | |
export default React.createClass({ | |
getInitialState() { |
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
import React, { | |
AppRegistry, | |
Component | |
} from 'react-native'; | |
import App from './app'; | |
class RNApp extends Component { | |
render() { | |
return <App />; |
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
import React, { | |
AppRegistry, | |
Component | |
} from 'react-native'; | |
import App from './app'; | |
class RNApp extends Component { | |
render() { | |
return <App />; |
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
import React, { | |
View, | |
Text, | |
StyleSheet | |
} from 'react-native'; | |
import Button from './button'; | |
import DDPClient from 'ddp-client'; | |
let ddpClient = new DDPClient(); |
OlderNewer