Skip to content

Instantly share code, notes, and snippets.

@bulentv
Created February 9, 2017 11:00
Show Gist options
  • Save bulentv/47eeec33cacaa7f85b2dfab6156451a0 to your computer and use it in GitHub Desktop.
Save bulentv/47eeec33cacaa7f85b2dfab6156451a0 to your computer and use it in GitHub Desktop.
es6test.js
"use strict";
function startTest(cb) {
setTimeout( () => {
let a = 1;
if(true) {
console.log(a);
cb();
}
}, 100);
}
class testClass {
constructor() {
console.log("constructed");
this._testv = 0;
}
get testValue() {
return 'a-haa, getter? ' + this._testv;
}
set testValue(v) {
this._testv = v + ' <-- sleepin?';
}
resetV() {
this._testv = -1;
this.inc();
}
inc() {
this._testv++;
}
start() {
let b = 2;
setTimeout( () => {
startTest( () => {
this.inc();
this.inc();
this.inc();
console.log(b);
console.log(this.d);
console.log(this.testValue);
this.testValue = 'zzz';
console.log(this.testValue);
this.resetV();
});
}, 500);
this.d = 4;
}
}
var t = new testClass();
t.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment