If we evaluate Object.keys(this)
in the Drafts 5 JSContext, we get a recognisable list of the top-level names in the documented Drafts 5 API.
The only name that I don’t immediately recognise, or see in the documentation, is $
.
Is $
private API, or is it bound to something that might be helpful to a user ?
(To see a fuller listing of the API, you can create a Script Action containing:
(function() {
const main = () => {
const
g = this,
ks = keySort(
Object.keys(g)
);
// NEW DRAFTS 5 SHEET
editor.new();
// POPULATED WITH LISTING OF OBJECTS PROPERTIES AND METHODS
// IN THE DRAFTS 5 JAVASCRIPT INTERFACE
editor.setText(
ks.map(k => {
const
o = g[k],
c = o.constructor,
t = typeof c,
blnC = t !== 'object',
noise = ['constructor', 'prototype'],
nest = Object.getOwnPropertyNames(
blnC ? (
o
) : o.constructor.prototype
).filter(x => !noise.includes(x)),
rest = blnC ? Object.getOwnPropertyNames(
o.prototype
).filter(x => !noise.includes(x)) : [],
fs = nest.concat(rest);
return k + '\n' + (fs.length > 0 ? (
keySort(fs).map(s => ' ' + s).join('\n')
) : '');
}).join('\n')
);
};
const keySort = xs => {
const ys = xs.slice(0);
return (
ys.sort((a, b) => {
const
la = a.toLowerCase(),
lb = b.toLowerCase();
return la < lb ? -1 : la > lb ? 1 : 0;
}),
ys
);
};
const showJSON = x => JSON.stringify(x, null, 2);
// -------------------------------
return main();
})();