From f7978b234a6dff108b2469138ef3b5fdbe62b405 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Tue, 7 May 2019 08:34:01 -0400 Subject: [PATCH] site: document export-as (#2559) --- site/content/docs/01-component-format.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index b689196d17..356fa1170d 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -35,7 +35,12 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property* // these properties can be set externally export let foo; export let bar = 'optional default value'; - + + // you can use export { ... as ... } to have + // props whose names are reserved keywords + let clazz; + export { clazz as class }; + // this property is readonly externally export const buzz = 'buzz'; @@ -48,6 +53,13 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property* export function instanceMethod() { alert(foo); } + + // you can also use export { ... as ... } to have + // methods whose names are reserved keywords + function del() { + do_something(); + } + export { del as delete }; ```