UNPKG

@compodoc/compodoc

Version:

The missing documentation tool for your Angular application

734 lines (595 loc) 21.6 kB
<!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>sample-files documentation</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="../images/favicon.ico"> <link rel="stylesheet" href="../styles/style.css"> <link rel="stylesheet" href="../styles/dark.css" media="(prefers-color-scheme: dark)"> </head> <body> <div class="navbar navbar-default navbar-fixed-top visible-xs"> <a href="../" class="navbar-brand">sample-files documentation</a> <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button> </div> <div class="xs-menu menu" id="mobile-menu"> <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu> </div> <div class="container-fluid main"> <div class="row main"> <div class="hidden-xs menu"> <compodoc-menu mode="normal"></compodoc-menu> </div> <!-- START CONTENT --> <div class="content component"> <div class="content-data"> <ol class="breadcrumb"> <li>Components</li> <li > AboutComponent2</li> </ol> <ul class="nav nav-tabs" role="tablist"> <li class="active"> <a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a> </li> <li > <a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a> </li> <li > <a href="#tree" role="tab" id="tree-tab" data-toggle="tab" data-link="dom-tree">DOM Tree</a> </li> </ul> <div class="tab-content"> <div class="tab-pane fade active in" id="c-info"><p class="comment"> <h3>File</h3> </p> <p class="comment"> <code>src/typings.ts</code> </p> <p class="comment"> <h3>Description</h3> </p> <p class="comment"> <p>The about component</p> <p>Display some text with links for details about TodoMVC &amp; Compodoc.</p> </p> <p class="comment"> <h3>Implements</h3> </p> <p class="comment"> <code><a href="https://angular.io/api/core/OnInit" target="_blank" >OnInit</a></code> </p> <section> <h3>Metadata</h3> <table class="table table-sm table-hover"> <tbody> <tr> <td class="col-md-3">selector</td> <td class="col-md-9"><code>about</code></td> </tr> <tr> <td class="col-md-3">template</td> <td class="col-md-9"><pre class="line-numbers"><code class="language-html">about.component</code></pre></td> </tr> </tbody> </table> </section> <section> <h3 id="index">Index</h3> <table class="table table-sm table-bordered index-table"> <tbody> <tr> <td class="col-md-4"> <h6><b>Methods</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <a href="#ngOnInit" >ngOnInit</a> </li> <li> <a href="#onMouseup" >onMouseup</a> </li> </ul> </td> </tr> <tr> <td class="col-md-4"> <h6><b>HostListeners</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <a href="#mouseup" >mouseup</a> </li> </ul> </td> </tr> </tbody> </table> </section> <section> <h3>HostListeners</h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="mouseup"></a> <span class="name"> <span ><b>mouseup</b></span> <a href="#mouseup"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <code>mouseup()</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="293" class="link-to-prism">src/typings.ts:293</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>HostListener mouseup description</p> </div> </td> </tr> </tbody> </table> </section> <section> <h3 id="methods"> Methods </h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="ngOnInit"></a> <span class="name"> <span ><b>ngOnInit</b></span> <a href="#ngOnInit"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <code>ngOnInit()</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="287" class="link-to-prism">src/typings.ts:287</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"> <b>Returns : </b> <code><a href="../miscellaneous/variables.html#id" target="_self" >void</a></code> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="onMouseup"></a> <span class="name"> <span ><b>onMouseup</b></span> <a href="#onMouseup"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <code>onMouseup()</code> </td> </tr> <tr> <td class="col-md-4"> <b>Decorators : </b> <br /> <code>@HostListener(&#x27;mouseup&#x27;)<br /></code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="293" class="link-to-prism">src/typings.ts:293</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>HostListener mouseup description</p> </div> <div class="io-description"> <b>Returns : </b> <code><a href="../miscellaneous/variables.html#id" target="_self" >void</a></code> </div> </td> </tr> </tbody> </table> </section> </div> <div class="tab-pane fade tab-source-code" id="c-source"> <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable } from &#x27;@angular/core&#x27;; import { PipeTransform, Pipe } from &#x27;@angular/core&#x27;; import { Directive, HostBinding, HostListener, Input } from &#x27;@angular/core&#x27;; import { Component, OnInit } from &#x27;@angular/core&#x27;; import { NgModule } from &#x27;@angular/core&#x27;; import { Todo } from &#x27;./app/shared/models/todo.model&#x27;; import { LabelledTodo } from &#x27;./app/shared/interfaces/interfaces&#x27;; namespace BSBO { export namespace Events { /** * A time interface just for documentation purpose */ export interface TimeInterface2 { /** * The zone */ zone: string; } /** * The todo class * * See {@link TodoStore} for service using it */ export class Todo2 { /** * Completed status */ completed: boolean; /** * Editing status */ editing: boolean; /** * Title */ private _title: string; get title() { return this._title; } set title(value: string) { this._title &#x3D; value.trim(); } static classMethod() { return &#x27;hello&#x27;; } constructor(title: string) { this.completed &#x3D; false; this.editing &#x3D; false; this.title &#x3D; title.trim(); } /** * fakeMethod !! * * @example &lt;caption&gt;Usage of fakeMethod&lt;/caption&gt; * * returns true; * * fakeMethod() */ fakeMethod(): boolean { return true; } } /** * Uppercase the first letter of the string * * __Usage :__ * value | firstUpper:exponent * * __Example :__ * {{ car | firstUpper}} * formats to: Car */ @Pipe({ name: &#x27;firstUpper&#x27; }) export class FirstUpperPipe2 implements PipeTransform { transform(value, args) { return value.charAt(0).toUpperCase() + value.slice(1); } } /** * This service is a todo store * * See {@link Todo} for details about the main data of this store */ @Injectable() export class TodoStore2 { /** * Local array of Todos * * See {@link Todo} */ todos: Array&lt;Todo&gt;; constructor() { let persistedTodos &#x3D; JSON.parse(localStorage.getItem(&#x27;angular2-todos&#x27;) || &#x27;[]&#x27;); // Normalize back into classes this.todos &#x3D; persistedTodos.map((todo: { _title: string; completed: boolean }) &#x3D;&gt; { let ret &#x3D; new Todo(todo._title); ret.completed &#x3D; todo.completed; return ret; }); } private updateStore() { localStorage.setItem(&#x27;angular2-todos&#x27;, JSON.stringify(this.todos)); } private getWithCompleted(completed: Boolean) { return this.todos.filter((todo: Todo) &#x3D;&gt; todo.completed &#x3D;&#x3D;&#x3D; completed); } /** * All the todos are they __completed__ ? * * @returns {boolean} All completed ? */ allCompleted(): boolean { return this.todos.length &#x3D;&#x3D;&#x3D; this.getCompleted().length; } /** * Set all todos status (completed or not) * * @example * // set all at completed * TodoStore.setAllTo(true); * * @example * // set all at not completed * TodoStore.setAllTo(false); * * @param {boolean} completed Status of all todos */ setAllTo(completed: boolean) { this.todos.forEach((t: Todo) &#x3D;&gt; (t.completed &#x3D; completed)); this.updateStore(); } /** * Remove completed todos */ removeCompleted() { this.todos &#x3D; this.getWithCompleted(false); this.updateStore(); } /** * Get remaining todos * * @returns {Array} All remaining todos */ getRemaining() { return this.getWithCompleted(false); } /** * Get all todos * * @returns {Array} All todos */ getAll() { return this.todos; } /** * Get completed todos * * @returns {Array} All completed todos */ getCompleted() { return this.getWithCompleted(true); } /** * Toggle completed todo status * * @param {Todo} todo Todo which change status */ toggleCompletion(todo: Todo) { todo.completed &#x3D; !todo.completed; this.updateStore(); } /** * Remove todo * * See {@link Todo} * * @param {Todo} todo Todo to remove * @param {any[]} theArgs the rest of arguments */ remove(todo: Todo, ...theArgs) { this.todos.splice(this.todos.indexOf(todo), 1); this.updateStore(); } /** * Update store */ update() { this.updateStore(); } /** * Add todo * * @param {string} title Title of todo */ add(title: string) { this.todos.push(new Todo(title)); this.updateStore(); } /** * Stop monitoring the todo * * @param {LabelledTodo} theTodo A todo * @returns {Promise&lt;void&gt;} promise resolved once we stop monitoring the todo or it is rejected */ stopMonitoring(theTodo?: LabelledTodo): Promise&lt;void&gt; { return new Promise&lt;void&gt;((resolve, reject) &#x3D;&gt; { //TODO }); } } /** * This directive does nothing ! */ @Directive({ selector: &#x27;[donothing]&#x27; }) export class DoNothingDirective2 { protected popover: string; /** * constructor description */ constructor() { console.log(&#x27;Do nothing directive&#x27;); } /** * HostBinding description */ @HostBinding(&#x27;style.color&#x27;) color: string; /** * HostListener description 1 */ @HostListener(&#x27;mouseup&#x27;, [&#x27;$event.clientX&#x27;, &#x27;$event.clientY&#x27;]) onMouseup(mouseX: number, mouseY: number): void {} /** * HostListener description 2 */ @HostListener(&#x27;mousedown&#x27;, [&#x27;$event.clientX&#x27;, &#x27;$event.clientY&#x27;]) onMousedown(mouseX: number, mouseY: number): void {} /** * HostListener description 3 */ @HostListener(&#x27;click&#x27;) onClick(): void {} } /** * The about component * * Display some text with links for details about TodoMVC &amp; Compodoc. */ @Component({ selector: &#x27;about&#x27;, template: &#x27;about.component&#x27; }) export class AboutComponent2 implements OnInit { ngOnInit() {} /** * HostListener mouseup description */ @HostListener(&#x27;mouseup&#x27;) onMouseup(): void {} } /** * The about module * * Just embedding &lt;about&gt; component and it&#x27;s routing definition in {@link AboutRoutingModule} */ @NgModule({ declarations: [], imports: [] }) export class AboutModule2 {} /** * PI constant * See {@link Todo} for service using it */ export const PI2: number &#x3D; 3.14; /** * A foo bar function * * @param {string} status A status */ export function foo2(status: string) { console.log(&#x27;bar&#x27;); } export type Name2 &#x3D; string; export enum PopupEffect2 { fadeIn, fadeOut, bubbleIn, bubbleOut } } } </code></pre> </div> <div class="tab-pane fade " id="c-tree"> <div id="tree-container"></div> <div class="tree-legend"> <div class="title"> <b>Legend</b> </div> <div> <div class="color htmlelement"></div><span>Html element</span> </div> <div> <div class="color component"></div><span>Component</span> </div> <div> <div class="color directive"></div><span>Html element with directive</span> </div> </div> </div> </div> <script src="../js/libs/vis.min.js"></script> <script src="../js/libs/htmlparser.js"></script> <script src="../js/libs/deep-iterator.js"></script> <script> var COMPONENT_TEMPLATE = '<div>about.component</div>' var COMPONENTS = [{'name': 'AboutComponent', 'selector': 'about'},{'name': 'AboutComponent2', 'selector': 'about'},{'name': 'AppComponent', 'selector': 'app-root'},{'name': 'CompodocComponent', 'selector': 'compodoc'},{'name': 'DumbComponent', 'selector': 'cp-dumb'},{'name': 'FooterComponent', 'selector': 'footer'},{'name': 'GenericComponent', 'selector': 'app-generic'},{'name': 'GrandsonComponent', 'selector': ''},{'name': 'HeaderComponent', 'selector': 'header'},{'name': 'HomeComponent', 'selector': 'home'},{'name': 'InheritDirComponent', 'selector': ''},{'name': 'JigsawTab', 'selector': 'jigsaw-tab'},{'name': 'ListComponent', 'selector': 'list'},{'name': 'MotherComponent', 'selector': ''},{'name': 'SonComponent', 'selector': ''},{'name': 'TodoComponent', 'selector': 'todo'},{'name': 'TodoMVCComponent', 'selector': 'todomvc'}]; var DIRECTIVES = [{'name': 'BaseDirective', 'selector': ''},{'name': 'DoNothingDirective', 'selector': '[donothing]'},{'name': 'DoNothingDirective2', 'selector': '[donothing]'}]; var ACTUAL_COMPONENT = {'name': 'AboutComponent2'}; </script> <script src="../js/tree.js"></script> </div><div class="search-results"> <div class="has-results"> <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1> <ul class="search-results-list"></ul> </div> <div class="no-results"> <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1> </div> </div> </div> <!-- END CONTENT --> </div> </div> <script> var COMPODOC_CURRENT_PAGE_DEPTH = 1; var COMPODOC_CURRENT_PAGE_CONTEXT = 'component'; var COMPODOC_CURRENT_PAGE_URL = 'AboutComponent2.html'; var MAX_SEARCH_RESULTS = 15; </script> <script src="../js/libs/custom-elements.min.js"></script> <script src="../js/libs/lit-html.js"></script> <script src="../js/menu-wc.js" defer></script> <script nomodule src="../js/menu-wc_es5.js" defer></script> <script src="../js/libs/bootstrap-native.js"></script> <script src="../js/libs/es6-shim.min.js"></script> <script src="../js/libs/EventDispatcher.js"></script> <script src="../js/libs/promise.min.js"></script> <script src="../js/libs/zepto.min.js"></script> <script src="../js/compodoc.js"></script> <script src="../js/tabs.js"></script> <script src="../js/menu.js"></script> <script src="../js/libs/clipboard.min.js"></script> <script src="../js/libs/prism.js"></script> <script src="../js/sourceCode.js"></script> <script src="../js/search/search.js"></script> <script src="../js/search/lunr.min.js"></script> <script src="../js/search/search-lunr.js"></script> <script src="../js/search/search_index.js"></script> <script src="../js/lazy-load-graphs.js"></script> </body> </html>