[docs] removes the signiture from docs for functions

pull/7235/head
ehsan 5 years ago
parent 843c3d4fc8
commit c9c34b915d

@ -251,13 +251,6 @@ export class SvelteComponent {
this.$destroy = noop;
}
/**
*
* ```ts
* component.$on(event, callback)
* ```
*
* ---
*
* Causes the `callback` function to be called whenever the component dispatches an `event`.
*
* A function is returned that will remove the event listener when called.
@ -284,13 +277,6 @@ export class SvelteComponent {
};
}
/**
*
* ```ts
* component.$set(props)
* ```
*
* ---
*
* Programmatically sets props on an instance. `component.$set({ x: 1 })` is equivalent to `x = 1` inside the component's `<script>` block.
*
* Calling this method schedules an update for the next microtask the DOM is *not* updated synchronously.

@ -11,12 +11,6 @@ export function get_current_component() {
return current_component;
}
/**
* ```ts
* beforeUpdate(callback: () => void)
* ```
*
* ---
*
* Schedules a callback to run immediately before the component is updated after any state change.
*
* > The first time the callback runs will be before the initial `onMount`
@ -37,16 +31,6 @@ export function beforeUpdate(fn: () => any) {
get_current_component().$$.before_update.push(fn);
}
/**
*
* ```ts
* onMount(callback: () => void)
* ```
* ```ts
* onMount(callback: () => () => void)
* ```
*
* ---
*
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. It must be called during the component's initialisation (but doesn't need to live *inside* the component; it can be called from an external module).
*
* `onMount` does not run inside a [server-side component](https://svelte.dev/docs#run-time-server-side-component-api).
@ -87,13 +71,6 @@ export function onMount(fn: () => any | (() => any)) {
get_current_component().$$.on_mount.push(fn);
}
/**
*
* ```ts
* afterUpdate(callback: () => void)
* ```
*
* ---
*
* Schedules a callback to run immediately after the component has been updated.
*
* > The first time the callback runs will be after the initial `onMount`
@ -114,13 +91,6 @@ export function afterUpdate(fn: () => any) {
get_current_component().$$.after_update.push(fn);
}
/**
*
* ```ts
* onDestroy(callback: () => void)
* ```
*
* ---
*
* Schedules a callback to run immediately before the component is unmounted.
*
* Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the only one that runs inside a server-side component.
@ -141,13 +111,6 @@ export function onDestroy(fn: () => any) {
get_current_component().$$.on_destroy.push(fn);
}
/**
*
* ```ts
* dispatch: ((name: string, detail?: any) => void) = createEventDispatcher();
* ```
*
* ---
*
* Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs#template-syntax-component-directives-on-eventname). Event dispatchers are functions that can take two arguments: `name` and `detail`.
*
* Component events created with `createEventDispatcher` create a [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture) and are not cancellable with `event.preventDefault()`. The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) property and can contain any type of data.
@ -197,13 +160,6 @@ export function createEventDispatcher<
};
}
/**
*
* ```ts
* setContext(key: any, context: any)
* ```
*
* ---
*
* Associates an arbitrary `context` object with the current component and the specified `key`. The context is then available to children of the component (including slotted content) with `getContext`.
*
* Like lifecycle functions, this must be called during component initialisation.
@ -225,13 +181,6 @@ export function setContext<T>(key: any, context: T) {
get_current_component().$$.context.set(key, context);
}
/**
*
* ```ts
* context: any = getContext(key: any)
* ```
*
* ---
*
* Retrieves the context that belongs to the closest parent component with the specified `key`. Must be called during component initialisation.
*
* ```html
@ -249,13 +198,6 @@ export function getContext<T>(key: any): T {
return get_current_component().$$.context.get(key);
}
/**
*
* ```ts
* contexts: Map<any, any> = getAllContexts()
* ```
*
* ---
*
* Retrieves the whole context map that belongs to the closest parent component. Must be called during component initialisation. Useful, for example, if you programmatically create a component and want to pass the existing context to it.
*
* ```html
@ -272,13 +214,6 @@ export function getAllContexts<T extends Map<any, any> = Map<any, any>>(): T {
return get_current_component().$$.context;
}
/**
*
* ```ts
* hasContext: boolean = hasContext(key: any)
* ```
*
* ---
*
* Checks whether a given `key` has been set in the context of a parent component. Must be called during component initialisation.
*
* ```html

@ -18,13 +18,6 @@ export function schedule_update() {
}
}
/**
*
* ```ts
* promise: Promise = tick()
* ```
*
* ---
*
* Returns a promise that resolves once any pending state changes have been applied, or in the next microtask if there are none.
*
* ```html

@ -72,13 +72,6 @@ export function subscribe(store, ...callbacks) {
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
/**
*
* ```ts
* value: any = get(store)
* ```
*
* ---
*
* Generally, you should read the value of a store by subscribing to it and using the value as it changes over time. Occasionally, you may need to retrieve the value of a store to which you're not subscribed. `get` allows you to do so.
*
* > This works by creating a subscription, reading the value, then unsubscribing. It's therefore not recommended in hot code paths.

@ -74,11 +74,6 @@ export interface Spring<T> extends Readable<T>{
precision: number;
}
/**
*
* ```ts
* store = spring(value: any, options)
* ```
*
* A `spring` store gradually changes to its target value based on its `stiffness` and `damping` parameters. Whereas `tweened` stores change their values over a fixed duration, `spring` stores change over a duration that is determined by their existing velocity, allowing for more natural-seeming motion in many situations. The following options are available:
*
* * `stiffness` (`number`, default `0.15`) a value between 0 and 1 where higher means a 'tighter' spring

@ -76,11 +76,6 @@ export interface Tweened<T> extends Readable<T> {
}
/**
*
* ```ts
* store = tweened(value: any, options)
* ```
*
* Tweened stores update their values over a fixed duration. The following options are available:
*
* * `delay` (`number`, default 0) milliseconds before starting

@ -46,13 +46,6 @@ type SubscribeInvalidateTuple<T> = [Subscriber<T>, Invalidator<T>];
const subscriber_queue = [];
/**
*
* ```ts
* store = readable(value?: any, start?: (set: (value: any) => void) => () => void)
* ```
*
* ---
*
* Creates a store whose value cannot be set from 'outside', the first argument is the store's initial value, and the second argument to `readable` is the same as the second argument to `writable`.
*
* ```ts
@ -80,16 +73,6 @@ export function readable<T>(initialValue?: T, start?: StartStopNotifier<T>): Rea
}
/**
*
* ```ts
* store = writable(initial_value?: any)
* ```
* ```ts
* store = writable(initial_value?: any, start?: (set: (value: any) => void) => () => void)
* ```
*
* ---
*
* Function that creates a store which has values that can be set from 'outside' components. It gets created as an object with additional `set` and `update` methods.
*
* `set` is a method that takes one argument which is the value to be set. The store value gets set to the value of the argument if the store value is not already equal to it.
@ -192,25 +175,6 @@ type StoresValues<T> = T extends Readable<infer U> ? U :
{ [K in keyof T]: T[K] extends Readable<infer U> ? U : never };
/**
*
* ```ts
* store = derived(a, callback: (a: any) => any)
* ```
* ---
* ```ts
* store = derived(a, callback: (a: any, set: (value: any) => void) => void | () => void, initial_value: any)
* ```
* ---
* ```ts
* store = derived([a, ...b], callback: ([a: any, ...b: any[]]) => any)
* ```
* ---
* ```ts
* store = derived([a, ...b], callback: ([a: any, ...b: any[]], set: (value: any) => void) => void | () => void, initial_value: any)
* ```
*
* ---
*
* Derives a store from one or more other stores. The callback runs initially when the first subscriber subscribes and then whenever the store dependencies change.
*
* In the simplest version, `derived` takes a single store, and the callback returns a derived value.

Loading…
Cancel
Save