docs(API): 翻译完了 Renderer2

This commit is contained in:
Zhicheng Wang 2018-09-05 10:48:08 +08:00
parent d589eef668
commit cf01a7f5d4
2 changed files with 198 additions and 1 deletions

View File

@ -39,7 +39,7 @@
[x] | core/Pipe | 0.52
[x] | common/NgSwitch | 0.52
[x] | forms/NgForm | 0.50
[ ] | core/Renderer2 | 0.49
[x] | core/Renderer2 | 0.49
[x] | core/HostListener | 0.47
[x] | common/AsyncPipe | 0.45
[x] | core/ViewContainerRef | 0.42

View File

@ -193,14 +193,23 @@ export enum RendererStyleFlags2 {
* renders a template into DOM. You can use custom rendering to intercept
* rendering calls, or to render to something other than DOM.
*
* Angular DOM
* 使 DOM 西
*
* Create your custom renderer using `RendererFactory2`.
*
* 使 `RendererFactory2`
*
* Use a custom renderer to bypass Angular's templating and
* make custom UI changes that can't be expressed declaratively.
* For example if you need to set a property or an attribute whose name is
* not statically known, use the `setProperty()` or
* `setAttribute()` method.
*
* 使 Angular UI
* Property Attribute使 `setProperty()`
* `setAttribute()`
*
* @experimental
*/
export abstract class Renderer2 {
@ -208,155 +217,343 @@ export abstract class Renderer2 {
* Use to store arbitrary developer-defined data on a renderer instance,
* as an object containing key-value pairs.
* This is useful for renderers that delegate to other renderers.
*
* key-value
*
*/
abstract get data(): {[key: string]: any};
/**
* Implement this callback to destroy the renderer or the host element.
*
* 便宿
*/
abstract destroy(): void;
/**
* Implement this callback to create an instance of the host element.
*
* 便宿
*
* @param name An identifying name for the new element, unique within the namespace.
*
*
*
* @param namespace The namespace for the new element.
*
*
*
* @returns The new element.
*
*
*/
abstract createElement(name: string, namespace?: string|null): any;
/**
* Implement this callback to add a comment to the DOM of the host element.
*
* 便宿 DOM
*
* @param value The comment text.
*
*
*
* @returns The modified element.
*
*
*/
abstract createComment(value: string): any;
/**
* Implement this callback to add text to the DOM of the host element.
*
* 便宿 DOM
*
* @param value The text string.
*
*
*
* @returns The modified element.
*
*
*/
abstract createText(value: string): any;
/**
* If null or undefined, the view engine won't call it.
* This is used as a performance optimization for production mode.
*
* null undefined
*
*/
// TODO(issue/24571): remove '!'.
destroyNode !: ((node: any) => void) | null;
/**
* Appends a child to a given parent node in the host element DOM.
*
* 宿 DOM
*
* @param parent The parent node.
*
*
*
* @param newChild The new child node.
*
*
*/
abstract appendChild(parent: any, newChild: any): void;
/**
* Implement this callback to insert a child node at a given position in a parent node
* in the host element DOM.
*
* 便宿
*
* @param parent The parent node.
*
*
*
* @param newChild The new child nodes.
*
*
*
* @param refChild The existing child node that should precede the new node.
*
*
*/
abstract insertBefore(parent: any, newChild: any, refChild: any): void;
/**
* Implement this callback to remove a child node from the host element's DOM.
*
* 便宿 DOM
*
* @param parent The parent node.
*
*
*
* @param oldChild The child node to remove.
*
*
*/
abstract removeChild(parent: any, oldChild: any): void;
/**
* Implement this callback to prepare an element to be bootstrapped
* as a root element, and return the element instance.
*
*
*
* @param selectorOrNode The DOM element.
*
* DOM
*
* @returns The root element.
*
*
*/
abstract selectRootElement(selectorOrNode: string|any): any;
/**
* Implement this callback to get the parent of a given node
* in the host element's DOM.
*
* 宿 DOM
*
* @param node The child node to query.
*
*
*
* @returns The parent node, or null if there is no parent.
* For WebWorkers, always returns true.
* This is because the check is synchronous,
* and the caller can't rely on checking for null.
*
* null
* WebWorkers `true`
* null
*/
abstract parentNode(node: any): any;
/**
* Implement this callback to get the next sibling node of a given node
* in the host element's DOM.
*
* 宿 DOM
*
* @returns The sibling node, or null if there is no sibling.
* For WebWorkers, always returns a value.
* This is because the check is synchronous,
* and the caller can't rely on checking for null.
*
* null
* WebWorkers `true`
* null
*/
abstract nextSibling(node: any): any;
/**
* Implement this callback to set an attribute value for an element in the DOM.
*
* 便 DOM
*
* @param el The element.
*
*
*
* @param name The attribute name.
*
*
*
* @param value The new value.
*
*
*
* @param namespace The namespace.
*
*
*/
abstract setAttribute(el: any, name: string, value: string, namespace?: string|null): void;
/**
* Implement this callback to remove an attribute from an element in the DOM.
*
* 便 DOM
*
* @param el The element.
*
*
*
* @param name The attribute name.
*
*
*
* @param namespace The namespace.
*
*
*/
abstract removeAttribute(el: any, name: string, namespace?: string|null): void;
/**
* Implement this callback to add a class to an element in the DOM.
*
* 便 DOM CSS
*
* @param el The element.
*
*
*
* @param name The class name.
*
* CSS
*/
abstract addClass(el: any, name: string): void;
/**
* Implement this callback to remove a class from an element in the DOM.
*
* 便 DOM CSS
*
* @param el The element.
*
*
*
* @param name The class name.
*
* CSS
*/
abstract removeClass(el: any, name: string): void;
/**
* Implement this callback to set a CSS style for an element in the DOM.
*
* 便 DOM CSS
*
* @param el The element.
*
*
*
* @param style The name of the style.
*
*
*
* @param value The new value.
*
*
*
* @param flags Flags for style variations. No flags are set by default.
*
*
*/
abstract setStyle(el: any, style: string, value: any, flags?: RendererStyleFlags2): void;
/**
* Implement this callback to remove the value from a CSS style for an element in the DOM.
*
* 便 DOM CSS
*
* @param el The element.
*
*
*
* @param style The name of the style.
*
*
*
* @param flags Flags for style variations to remove, if set. ???
*
*
*/
abstract removeStyle(el: any, style: string, flags?: RendererStyleFlags2): void;
/**
* Implement this callback to set the value of a property of an element in the DOM.
*
* 便 DOM
*
* @param el The element.
*
*
*
* @param name The property name.
*
*
*
* @param value The new value.
*
*
*
*/
abstract setProperty(el: any, name: string, value: any): void;
/**
* Implement this callback to set the value of a node in the host element.
*
* 便宿
*
* @param node The node.
*
*
*
* @param value The new value.
*
*
*
*/
abstract setValue(node: any, value: string): void;
/**
* Implement this callback to start an event listener.
*
*
*
* @param target The context in which to listen for events. Can be
* the entire window or document, the body of the document, or a specific
* DOM element.
*
* body DOM
*
* @param eventName The event to listen for.
*
*
*
* @param callback A handler function to invoke when the event occurs.
*
*
*
* @returns An "unlisten" function for disposing of this handler.
*
* "取消监听"
*/
abstract listen(
target: 'window'|'document'|'body'|any, eventName: string,