mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
finished meteor core
This commit is contained in:
@@ -23,7 +23,14 @@ export default defineConfig({
|
||||
{ text: "API map", link: "/api/index" },
|
||||
{ text: "Runtime API Examples", link: "/api-examples" },
|
||||
{ text: "Accounts", link: "/api/accounts" },
|
||||
{ text: "Meteor", link: "/api/meteor" },
|
||||
{
|
||||
text: "Meteor",
|
||||
link: "/api/meteor",
|
||||
items: [
|
||||
{ text: "Core", link: "/api/meteor#core" },
|
||||
{ text: "Methods", link: "/api/meteor#methods" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -39,5 +46,9 @@ export default defineConfig({
|
||||
copyright:
|
||||
'Copyright (c) 2011 - present <a href="https://www.meteor.com/">Meteor Software</a>.',
|
||||
},
|
||||
editLink: {
|
||||
pattern: 'https://github.com/meteor/meteor/edit/main/v3-docs/docs/:path',
|
||||
text: 'Edit this page on GitHub'
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
Meteor global object has many functions and properties for handling utilities, network and much more.
|
||||
|
||||
|
||||
### Core APIs {#core}
|
||||
|
||||
<ApiBox name="Meteor.startup" hasCustomExample/>
|
||||
|
||||
On a server, the function will run as soon as the server process is
|
||||
@@ -51,6 +54,11 @@ Meteor.startup(() => {
|
||||
|
||||
:::
|
||||
|
||||
<ApiBox name="Meteor.wrapAsync" />
|
||||
<ApiBox name="Meteor.defer" />
|
||||
<ApiBox name="Meteor.absoluteUrl" />
|
||||
<ApiBox name="Meteor.settings" />
|
||||
<ApiBox name="Meteor.release" />
|
||||
|
||||
<ApiBox name="Meteor.isClient" />
|
||||
|
||||
@@ -70,3 +78,7 @@ should be kept in the `server` directory.
|
||||
<ApiBox name="Meteor.isTest" />
|
||||
<ApiBox name="Meteor.isAppTest" />
|
||||
<ApiBox name="Meteor.isPackageTest" />
|
||||
|
||||
<ApiBox name="Meteor.gitCommitHash" />
|
||||
|
||||
### Method APIs {#methods}
|
||||
|
||||
@@ -15,7 +15,7 @@ const props = defineProps<{
|
||||
optional: boolean;
|
||||
}[];
|
||||
}>()
|
||||
const removeTags = (str) => str.replace(/<[^>]*>?/gm, '')
|
||||
const removeTags = (str) => str?.replace(/<[^>]*>?/gm, '')
|
||||
|
||||
const primitiveMap = {
|
||||
function: '{Function}',
|
||||
@@ -33,27 +33,30 @@ const primitiveDefault = {
|
||||
Object: '<span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}',
|
||||
}
|
||||
|
||||
const makePrimitiveHTML = (primitive, index) => {
|
||||
if (index === 0) {
|
||||
return primitiveDefault[primitive] + `</span>`;
|
||||
}
|
||||
return primitiveDefault[primitive] + `,</span>`;
|
||||
const comma = `<span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span>`
|
||||
const br = `<br/>`;
|
||||
const comment = `<span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // this param is optional </span>`
|
||||
|
||||
const line = ({ html, pre, post } = { pre: '', post: '', html: '' }) => `${pre}<span class="line">${html}</span>${post}`
|
||||
const makePrimitiveHTML = (primitive, arr, index, isComment) => {
|
||||
if (arr.length > 1) return line(
|
||||
{
|
||||
html: primitiveDefault[primitive] + `${comma}</span>`,
|
||||
pre: index === 0 ? '' : br,
|
||||
post: isComment ? comment : '',
|
||||
}
|
||||
);
|
||||
return primitiveDefault[primitive] + `</span>`;
|
||||
}
|
||||
|
||||
const wrapInOptional = (optionalParam) => {
|
||||
return `[${optionalParam}]`
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="language-js vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">js</span>
|
||||
<pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { {{ props.memberof }} } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "meteor/{{ props.from }}"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/**</span></span>
|
||||
<span class="line" v-for="(param) in props.params" :key="param.name"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> @param </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">{{ primitiveMap[param.type.names[0]] }}</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {{ param.optional ? wrapInOptional(param.name) : param.name }}</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> {{ removeTags(param.description) }}</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> */</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{{ props.memberof }}.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">{{ props.fnName }}</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span></span>
|
||||
<span class="line" v-for="(param, index) in props.params" :key="param.name"><span v-html="makePrimitiveHTML([param.type.names[0]], index)"/></span>
|
||||
<span class="line" v-for="(param, index) in props.params" :key="param.name"><span v-html="makePrimitiveHTML([param.type.names[0]], props.params, index, param.optional)"/></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span></code></pre>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user