Although this isn't a problem in other languages, because of semicolon insertion, there could be problems if you don't place the bracket on the opening line:
// no:
function()
{
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-s | |
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L] | |
</IfModule> |
'use strict'; | |
var path = require('path'); | |
var webpack = require('webpack'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var WriteFilePlugin = require('write-file-webpack-plugin'); | |
var BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
const devServer = { |
const puppeteer = require('puppeteer') | |
let anime = {} | |
async function run (searched) { | |
searched = searched.replace(';', ' ') | |
// Setup pupeteer | |
const browser = await puppeteer.launch({ | |
headless: false, | |
}) |
ngOnInit() { | |
this.myForm = this.fb.group({ | |
myCheckbox: [''], | |
myEmailField: [ | |
'', | |
[ | |
Validators.maxLength(250), | |
Validators.minLength(5), | |
Validators.pattern(/.+@.+\..+/), | |
], |
<h2>My form</h2> | |
<form [formGroup]="myForm" (ngSubmit)="onSubmit()"> | |
<div> | |
Make email mandatory <input formControlName="myCheckbox" | |
type="checkbox"> | |
</div> | |
<div> | |
Email: <input formControlName="myEmailField" | |
type="email"> |
this.myForm.get('myCheckbox').valueChanges.subscribe((value) => { | |
if (value) { | |
this.myForm.get('myEmailField').setValidators(Validators.required); | |
} else { | |
this.myForm.get('myEmailField').clearValidators(); | |
} | |
}); |
private emailValidators = [ | |
Validators.maxLength(250), | |
Validators.minLength(5), | |
Validators.pattern(/.+@.+\..+/) | |
]; | |
ngOnInit() { | |
this.myForm = this.fb.group({ | |
myCheckbox: [''], | |
myEmailField: ['', this.emailValidators] |
const send = (file) => { | |
const xhr = new XMLHttpRequest(); | |
const formData = new FormData(); | |
formData.append("avatar", file); | |
xhr.open("POST", "/", true); | |
xhr.upload.onprogress = function(event) { | |
if (event.lengthComputable) { | |
const percent = (event.loaded / event.total) * 100; |