mirror of
https://github.com/HeyPuter/puter.git
synced 2025-12-30 09:40:00 -06:00
fix: get event docs back in sync
I used 'fix' for this instead of 'doc' because I am also adding a package for code that generates markdown, so this doesn't have the zero-risk nature typically associated with a "doc: " commit.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module.exports = [
|
||||
export default [
|
||||
{
|
||||
id: 'core.email.validate',
|
||||
description: `
|
||||
@@ -23,5 +23,28 @@ module.exports = [
|
||||
]
|
||||
},
|
||||
},
|
||||
}
|
||||
];
|
||||
},
|
||||
{
|
||||
id: 'core.request.measured',
|
||||
description: `
|
||||
This event is emitted when a requests incoming and outgoing bytes
|
||||
have been measured.
|
||||
`,
|
||||
example: {
|
||||
language: 'javascript',
|
||||
code: /*javascript*/`
|
||||
extension.on('core.request.measured', data => {
|
||||
const measurements = data.measurements;
|
||||
// measurements = { sz_incoming: integer, sz_outgoing: integer }
|
||||
|
||||
const actor = data.actor; // instance of Actor
|
||||
|
||||
console.log('\\x1B[36;1m === MEASUREMENT ===\\x1B[0m\\n', {
|
||||
actor: data.actor.uid,
|
||||
measurements: data.measurements
|
||||
});
|
||||
});
|
||||
`
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const dedent = require('dedent');
|
||||
const events = require('./events.json.js');
|
||||
import dedent from 'dedent';
|
||||
import events from './events.json.js';
|
||||
|
||||
const mdlib = {};
|
||||
mdlib.h = (out, n, str) => {
|
||||
@@ -20,11 +20,19 @@ for ( const event of events ) {
|
||||
out(`- **Type**: ${prop.type}\n`);
|
||||
out(`- **Mutability**: ${prop.mutability}\n`);
|
||||
if ( prop.notes ) {
|
||||
out(`- **Notes**: ${prop.n}\n`);
|
||||
out(`- **Notes**:\n`);
|
||||
for ( const note of prop.notes ) {
|
||||
out(` - ${note}\n`);
|
||||
}
|
||||
}
|
||||
out('\n');
|
||||
}
|
||||
|
||||
if ( event.example ) {
|
||||
mdlib.h(out, N_START + 1, `Example`);
|
||||
out(`\`\`\`${event.example.language}\n${dedent(event.example.code)}\n\`\`\`\n`);
|
||||
}
|
||||
|
||||
out('\n');
|
||||
|
||||
}
|
||||
|
||||
1
package-lock.json
generated
1
package-lock.json
generated
@@ -14,6 +14,7 @@
|
||||
"experiments/js-parse-and-output"
|
||||
],
|
||||
"dependencies": {
|
||||
"dedent": "^1.5.3",
|
||||
"javascript-time-ago": "^2.5.11",
|
||||
"json-colorizer": "^3.0.1",
|
||||
"open": "^10.1.0",
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"dedent": "^1.5.3",
|
||||
"javascript-time-ago": "^2.5.11",
|
||||
"json-colorizer": "^3.0.1",
|
||||
"open": "^10.1.0",
|
||||
|
||||
Reference in New Issue
Block a user