Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mootools Class - Calling a function within a function
- var Bob = new Class({
- initialize: function () {
- this.message = 'Hello';
- },
- someOther: function() {
- this.message2 = 'Bob';
- },
- getMessage: function() {
- return this.someOther();
- },
- });
- window.addEvent('domready', function() {
- var map = new Bob;
- alert(map.getMessage());
- });
- var Bob = new Class({
- initialize: function() {
- this.message = 'Hello';
- },
- someOther: function() {
- return this.message2 = 'Bob'; //bad
- },
- getMessage: function() {
- return this.someOther(); // why
- },
- });
- window.addEvent('domready', function() {
- var map = new Bob;
- alert(map.getMessage());
- alert(map.message2); // bob
- });
Advertisement
Add Comment
Please, Sign In to add comment