drush vset preprocess_css 0 --yes
drush vset preprocess_js 0 --yes
npm install vue-template-compiler@2.5.16 --save-dev |
class Car { | |
constructor(make, model) { | |
this.make = make; | |
this.model = model; | |
} | |
start() { | |
console.log('vroom'); | |
} | |
// "class" declaration | |
function Car(make, model) { | |
this.make = make; | |
this.model = model; | |
} | |
// the start method | |
Car.prototype.start = function() { | |
console.log('vroom'); | |
} |
const actions = new Map([ | |
[1, ['processing','IndexPage']], | |
[2, ['fail','FailPage']], | |
[3, ['fail','FailPage']], | |
[4, ['success','SuccessPage']], | |
[5, ['cancel','CancelPage']], | |
['default', ['other','Index']] | |
]) | |
const onButtonClick = (status)=>{ |
const actions = new Map([ | |
['guest_1', ()=>{/*do sth*/}], | |
['guest_2', ()=>{/*do sth*/}], | |
['guest_3', ()=>{/*do sth*/}], | |
['guest_4', ()=>{/*do sth*/}], | |
['guest_5', ()=>{/*do sth*/}], | |
['master_1', ()=>{/*do sth*/}], | |
['master_2', ()=>{/*do sth*/}], | |
['master_3', ()=>{/*do sth*/}], | |
['master_4', ()=>{/*do sth*/}], |
const actions = new Map([ | |
[{identity:'guest',status:1},()=>{/*do sth*/}], | |
[{identity:'guest',status:2},()=>{/*do sth*/}], | |
//... | |
]) | |
const onButtonClick = (identity,status)=>{ | |
let action = [...actions].filter(([key,value])=>(key.identity == identity && key.status == status)) | |
action.forEach(([key,value])=>value.call(this)) | |
} |
const actions = ()=>{ | |
const functionA = ()=>{/*do sth*/} | |
const functionB = ()=>{/*do sth*/} | |
return new Map([ | |
[{identity:'guest',status:1},functionA], | |
[{identity:'guest',status:2},functionA], | |
[{identity:'guest',status:3},functionA], | |
[{identity:'guest',status:4},functionA], | |
[{identity:'guest',status:5},functionB], | |
//... |
const actions = ()=>{ | |
const functionA = ()=>{/*do sth*/} | |
const functionB = ()=>{/*do sth*/} | |
return new Map([ | |
[/^guest_[1-4]$/,functionA], | |
[/^guest_5$/,functionB], | |
//... | |
]) | |
} |
const actions = ()=>{ | |
const functionA = ()=>{/*do sth*/} | |
const functionB = ()=>{/*do sth*/} | |
const functionC = ()=>{/*send log*/} | |
return new Map([ | |
[/^guest_[1-4]$/,functionA], | |
[/^guest_5$/,functionB], | |
[/^guest_.*$/,functionC], | |
//... | |
]) |