Created
October 2, 2014 10:32
-
-
Save garrilla/69b4fcd25e37b4362223 to your computer and use it in GitHub Desktop.
helper and invocation METEOR@0.9.4-pre.6
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
/* CSS declarations go here */ |
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>9.4.0pre2rc6</title> | |
</head> | |
<body> | |
<h1>Welcome to Meteor!</h1> | |
{{> hello}} | |
{{> invoker}} | |
</body> | |
<template name="hello"> | |
<button>Click Me</button> | |
<p>You've pressed the button {{counter}} times.</p> | |
</template> | |
<template name="invoker"> | |
<p>{{theOldWay}}</p> | |
</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
if (Meteor.isClient) { | |
// counter starts at 0 | |
Session.setDefault("counter", 0); | |
Template.hello.helpers({ | |
counter: function () { | |
return Session.get("counter"); | |
}, | |
possNewMethod: function(){ | |
console.log('we should never get here, this approach should generate an error'); | |
} | |
}); | |
Template.hello.events({ | |
'click button': function () { | |
// increment the counter when button is clicked | |
Session.set("counter", Session.get("counter") + 1); | |
} | |
}); | |
Template.hello.rendered=function(){ | |
console.log(Meteor.release) | |
Template.hello.utils.someFun(); | |
console.log(Template.hello.utils.someFun()) | |
console.log(Template.hello.theOldWay()); | |
console.log(Template.invoker.theOldWay()); | |
/* the following, if uncommented, will produce | |
TypeError: undefined is not a function | |
*/ | |
//Template.hello.possNewMethod(); | |
//Template.hello.helpers.possNewMethod(); | |
} | |
Template.hello.utils = { | |
someFun: function(){ | |
console.log('Look Mummy, no deprecation message...'); | |
return 'print some return text' | |
} | |
} | |
Template.hello.theOldWay = function(){ | |
console.log('Look Mummy, no deprecation message...'); | |
return 'theOldWay on the hello Template' | |
} | |
Template.invoker.theOldWay = function(){ | |
console.log('Oh No, Daddy, I got that deprecation message...'); | |
return 'theOldWay on the invoker Template' | |
} | |
} | |
if (Meteor.isServer) { | |
Meteor.startup(function () { | |
// code to run on server at startup | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment