Skip to content

Instantly share code, notes, and snippets.

View gskachkov's full-sized avatar

Oleksander Skachkov gskachkov

  • Itera Consulting
  • Ukraine, Kiev
View GitHub Profile
@globalPrivate
function next() {
}
@globalPrivate
function return() {
}
@globalPrivate
function throw() {
const objWithIterator = {
[Symbol.iterator]() {
return {
next: function() {
console.log('do next');
return {done: false, value: 'foo'};
},
return: function() {
console.log('do return');
return {done: true, value: 'foo'};
const myInterface = Symbol('myInterface');
export default myInterface;
function fakeGen() {
return {
[Symbol.iterator]: {}
}
}
let [...x] = fakeGen();
// We need error that [Symbol.iterator] is not callable
function foo () { retur\u006E 'boo'; }
// SyntaxError: Keyword must not contain escaped character
var ge\u006Enetic = 'ABCD'
conosle.log(ge\u006Enetic);
conosle.log(gennetic);
@gskachkov
gskachkov / variable.special.symbol.js
Created June 19, 2017 14:21
Special characters in variable names
var ಠ_ಠ = 15;
ಠ_ಠ = ಠ_ಠ + 10;
console.log(ಠ_ಠ);
import ngAsync from 'ng-async.decorator';
class FooController {
.....
@ngAsync()
async doFoo() {
this.asyncResult = await this.loadData();
this.status = 'loaded';
}
@gskachkov
gskachkov / async.function.decorator.js
Last active May 24, 2020 22:21
Decorator for async function in angular
import decoratorHelper from 'decorator.helper';
// Current decorator allow async function to be used in angular
// without adding unnecessary digest calls
const ngAync = function () {
return function (target, key, descriptor) {
const fn = descriptor.value;
descriptor.value = function () {
const result = fn.apply(this, arguments);
@gskachkov
gskachkov / async.function.controller.js
Created June 19, 2017 07:38
Using async function in angular 1.5
const _fooService = new WeakMap();
class FooController {
constructor(fooService) {
this.name = 'fooController';
_fooService.set(this, fooService);
this.title = 'Show data';