/**
* @NApiVersion 2.1
*/
define('PRIVATE_ES6', function() {
//https://5490577-sb2.app.netsuite.com/core/media/media.nl?id=48395&c=5490577_SB2&h=jY01tqIvVfQjWniSY2nY4zx7TM2HSgiqszg1D5lQ58ep7jOW&_xt=.js
const NCO = {};
NCO.shared = {};
/**
*
*/
class PRIVATE_ES6 {
/**
*
* @param input
*/
constructor({
//done
shared, //shared publically and set publically and apply to all instances e.g. shared information b/t them
pub, //readily listed and readily set properties for this object
publicreadonly, //readily listed but cannot set them i.e. protected
priv, //outside cannot examine these NOR set them
hidden,
privatereadonly,
//todo:
sharedstatic, //shared publically and apply to all instances but readonly -- set by class developer
sharedprivate, //outside cannot see them nor set them and they apply to all instances e.g. a config to change for all
constructoronly
}) {
//private to the instance
const secret = Symbol('private');
this.publicProp = 'publicProp';
const _ = NCO._defineProperties(this, secret, {
pub,
shared,
publicreadonly,
hidden,
priv,
privatereadonly
});
this.getProxy = (...args)=>{
return this[_.get](...args);
}
this.setProxy = (...args)=>{
return this[_.set](...args);
}
} //constructor
//DO NOT ASSIGN PUBLIC NOR PRIVATE METHODS HERE UNLESS THEY DO NOT NEED ACCESS TO OTHER PRIVATE METHODS
//ANY METHODS DECLARED HERE WILL BE OVERWRITTEN IF THEY ALSO EXIST IN THE PUBLIC /PRIVATE DEFINITION
getPublic() {
return 'this will get overwritten 😔';
}
//ASSIGN STATIC METHODS HERE
static Alive() {
return 'alive';
}
} //class
//get a this reference to the global registry (for sharing and / or obfuscating sharing )
PRIVATE_ES6.prototype.global = NCO.shared
//ASSIGN...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.