Private 1.0.0

Private is a mutator which let you write code which use a sort of private properties and methods



Details

Author
kentaromiura
Current version
1.0.0
GitHub
kentaromiura/Mootools-Private
Downloads
2724
Category
Native
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_:
    • Class
    • Class.PatternMutators

How to use

Just include keeto.PatternMutator.js and kenta.Private.js, then you can write code like the snippet below:

var Test = new Class({
    Implements:[Options],
    'private initialize':function(options, _private){
        this.setOptions(options);
        _private.test = 'Hello, '+ (options.name || 'world!');
    },
    'private say':function(i_can_call_this_as_i_want){
        alert(i_can_call_this_as_i_want.test);
    },
    a_normal_method:function(){
        alert("I don't use privates");
    }
});

var kenta = new Test({name:'kenta'});
kenta.say();
kenta.a_normal_method();

var test2 = new Test({});
test2.say();

//when done
test2['~']();
kenta['~']();​

in order to access the private method/properties you must decorate the method name adding 'private' just before the method name.


Mykenta Blogspot Com

here you can find other infos: http://mykenta.blogspot.it/2011/10/mootools-private-pattern-mutator.html

for 1.4, $uid was removed in favor of Slick.uidOf, so if you're using 1.4, just add this line:

var $uid = Slick.uidOf;

before loading kenta.Private.js.

I will update the plugin soon so that It will use Slick.uidOf.


Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus