Jump to content

why this variable is private


pat
 Share

Recommended Posts

Hello all,

 

Please, I am a newbie, so excuse my question.

I am looking at the code of Pixi, because I want to understand how works this code.

in Stage.js, I do not understand that

this.worldTransform or this.dirty are private ???

 

Thanks a lot

PIXI.Stage = function(backgroundColor){    PIXI.DisplayObjectContainer.call( this );    /**     * [read-only] Current transform of the object based on world (parent) factors     *     * @property worldTransform     * @type Mat3     * @readOnly     * @private     */    this.worldTransform = new PIXI.Matrix();    /**     * Whether or not the stage is interactive     *     * @property interactive     * @type Boolean     */    this.interactive = true;    /**     * The interaction manage for this stage, manages all interactive activity on the stage     *     * @property interactive     * @type InteractionManager     */    this.interactionManager = new PIXI.InteractionManager(this);    /**     * Whether the stage is dirty and needs to have interactions updated     *     * @property dirty     * @type Boolean     * @private     */    this.dirty = true;    //the stage is its own stage    this.stage = this;    //optimize hit detection a bit    this.stage.hitArea = new PIXI.Rectangle(0,0,100000, 100000);    this.setBackgroundColor(backgroundColor);};
Link to comment
Share on other sites

They are private because we mark them as such in the documentation, not that we use any language feature to enforce it. Javascript doesn't have the idea of public/protected/private; there are ways to "hide" properties from non-class methods but we do not employ any of those in Pixi.js

 

When you see @private, or @readOnly they are hints for the documentation; not hard enforced states. It just tells the user that they exists, but you probably shouldn't use them without knowing exactly what you are doing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...