summaryrefslogtreecommitdiff
path: root/doc/development/frontend.md
Commit message (Collapse)AuthorAgeFilesLines
* Fix bad code example29326-update-documentationFilipa Lacerda2017-03-131-2/+2
|
* Fix code examples and add code highligthFilipa Lacerda2017-03-101-5/+4
|
* Adds best practices regarding context and vue to documentationFilipa Lacerda2017-03-101-1/+32
|
* Adds information about architecture step.Filipa Lacerda2017-03-101-2/+20
|
* Add newline to end of frontend.md.patch-14Bryce Johnson2017-02-281-1/+1
|
* Document use of AirBnb js styleguide and eslint.Bryce Johnson2017-02-281-0/+5
|
* Merge branch 'replace-teaspoon-references' into 'master' Clement Ho2017-02-101-12/+6
|\ | | | | | | | | | | | | Replace teaspoon references with Karma Closes gitlab-com/gitlab-docs#68 See merge request !9011
| * Replace teaspoon references with Karmareplace-teaspoon-referencesClement Ho2017-02-101-12/+6
| |
* | moved hyperlink reference section at the end of the contentNur Rony2017-02-101-41/+43
| |
* | fixes frontend doc broken linkNur Rony2017-02-101-1/+1
|/
* First draft of "how to use vue.js in gitlab" documentationFilipa Lacerda2017-01-301-18/+88
| | | | | | | | | | | | Puts back trailing whitespace Changes after review Changes after review Adds Changelog entry Follow documentation styleguide
* Fix markdown errors.patch-9Bryce Johnson2016-12-211-2/+2
|
* Add documentation for possible causes of JS-related test failures.Bryce Johnson2016-12-211-10/+68
|
* Merge branch 'google-singletons-are' into 'master' Jacob Schatz2016-11-171-0/+51
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decide on and document a convention for singletons > The singleton pattern is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. The simplest implementation uses an object literal to contain the logic. ```javascript gl.MyThing = { prop1: 'hello', method1: () => {} }; ``` A live example of this is [GfmAutoComplete](https://gitlab.com/gitlab-org/gitlab-ce/blob/172aab108b875e8dc9a5f1d3c2d53018eff76ea1/app/assets/javascripts/gfm_auto_complete.js.es6) Another approach makes use of ES6 `class` syntax. ```javascript let singleton; class MyThing { constructor() { if (!singleton) { singleton = this; singleton.init(); } return singleton; } init() { this.prop1 = 'hello'; } method1() {} } gl.MyThing = MyThing; ``` A live example of this is [Sidebar](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/sidebar.js.es6) Another functional approach to define Singleton using `Javascript Revealing Module Pattern` is like below ```javascript /** * 1. It instantiates only a single object * 2. It is safe – it keeps the reference to the singleton inside a variable, which lives inside a lexical closure, so it is not accessible by the outside world * 3. It allows privacy – you can define all private methods of your singleton inside the lexical closure of the first module pattern * 4. No this keyword trap (no wrong context referring) * 5. No use of new keyword * 6. Easy to write test code */ // const Singleton = (function () { // Instance stores a reference to the Singleton var instance; function init() { // Singleton // Private methods and variables function privateMethod(){ console.log( "I am private" ); } var privateVariable = "Im also private"; var privateRandomNumber = Math.random(); return { // Public methods and variables publicMethod: function () { console.log( "The public can see me!" ); }, publicProperty: "I am also public", getRandomNumber: function() { return privateRandomNumber; } }; }; return { // Get the Singleton instance if one exists // or create one if it doesn't getInstance: function () { if ( !instance ) { instance = init(); } return instance; } }; })(); const singletonObj = Singleton.getInstance() ``` ## Are there points in the code the reviewer needs to double check? ## What does this MR do? Creates a space for discussion and contribution for interested devs. ## Why was this MR needed? ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] All builds are passing (http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? See merge request !6620
| * Fix spacing in code sample.google-singletons-areBryce Johnson2016-11-011-3/+5
| |
| * Document convention for singleton use in front-end code.Bryce Johnson2016-10-311-0/+49
| |
* | Fix broken link to observatory cli on Frontend Dev GuideSam Rose2016-11-061-1/+1
| |
* | Add tip for using Chrome to run and debug teaspoon tests.Bryce Johnson2016-11-031-0/+6
| |
* | Merge branch 'patch-8' into 'master' Fatih Acet2016-10-311-3/+8
|\ \ | |/ |/| | | | | | | | | | | | | Add ES array methods as cause of Phantom.js errors. ## What does this MR do? Adds another example of something that causes a common error in JavaScript testing to the frontend dev docs. See merge request !7102
| * Add ES array methods as cause of Phantom.js errors.Bryce Johnson2016-10-261-3/+8
| |
* | Document how to run frontend testsWinnie2016-10-281-0/+14
|/
* Document Capybara errors from es6 in es5 file.es6-es5-poltergeistBryce Johnson2016-10-121-0/+11
|
* Update Frontend Docs based on feedback.cs-frontend-guidelinesConnor Shea2016-09-211-18/+18
|
* Add a section on vue and one on supported browsers.Connor Shea2016-09-211-0/+14
|
* Add Overview section detailing our frontend stack. [ci skip]Connor Shea2016-09-211-5/+44
|
* Add short Testing section, minor fixes.Connor Shea2016-09-211-1/+7
|
* Add CSP and SRI information [ci skip]Connor Shea2016-09-211-3/+71
|
* Further revisions/additions [ci skip]Connor Shea2016-09-211-6/+17
|
* Add more information on page-specific JS.Connor Shea2016-09-211-19/+45
| | | | [ci skip]
* Initial incomplete draft of the Frontend Development Guidelines.Connor Shea2016-09-211-0/+61
[ci skip]