Atilla Tanrikulu

I am an experienced software engineer and architect living in Germany. I’m passionate about distributed scalable enterprise web-based microservices/applications and delivering great user experiences. I have created some amazing enterprise-level applications that many people have used and hopefully enjoyed.

Articles

Java Quick Reference Apache Kafka Tutorial Guvenli Kod Gelistirme Making an Enterprise Scale Angular Project Step by Step Nightly SQL Server Database Backup with command line batch file and windows scheduler AOP Framework without proxy pattern IdentityServer Nedir Middleware Pattern With Csharp And Javascript Docker most used commands Online Proje Dokumantasyonu, Docker, Nginx, mdwiki How to use Github Pages for static websites Inheritance with JavaScript, EC6 (ECMAScript 6, ECMAScript 2015) Object oriented javascript and Inheritance Singleton Pattern with Javascript Factory Pattern with Javascript Open terminal here mac os x service IdentityServer4-Angular-6-integration JMater notlari, kurulum ve kullanim Learn Jekyll in 12 Steps Make Mac Application with Automater from sh script Make spotlight index markdown or code files OAuth 2.0 Nedir (RFC6749) Using Custom CSS and Custom JavaScript to an Angular Project Cross Platform Desktop Application With .Net Core 2x and Angular 6x front-end projects with nodejs gulp bower yeoman and angularjs Host Asp.Net Core on Linux with Apache Redis kurulumu ve ayarlari Useful Mac OS Apps Choosing internet connection on multiple interface windows Name Server Kurulumu How to define domain name for your dynamic IP SQL table data compare, and prepare insert satements Useful Git Commands TFS ile Otomatik deployment yapmak Spring Boot Tutorial Sql server icin maliyetli sorgularin tespit edilmesi Arama Motoru Optimizasyonu (SEO) My installed mac apps

Singleton Pattern with Javascript


function SingletonClass(name){

  //check if instance exist, we can maintain Single instance with this.
  if(typeof SingletonClass.instance === 'object'){
    return SingletonClass.instance;
  }

  this.name = name;
  SingletonClass.instance = this;
	return this;
}



var mySingletonClass = SingletonClass("Variable");
document.write("My SingletonClass name is " + mySingletonClass.name + "<br />")

var nextSingletonClass = SingletonClass("next");
document.write("My SingletonClass name is " + mySingletonClass.name + "<br />")


Another Example


function AppSettings(){
  if(typeof AppSettings.instance === 'object'){
    return AppSettings.instance;
  }

  this.name = "Application1";
  this.url ="http://www.domain.com";
  this.defaultPageSize=30;
  this.defaultLang='en';

  //.....other application settings

  AppSettings.instance = this;
  return this;
}

Usage


var v1 = AppSettings.url;
console.log(v1);

Date: 2017-11-13 10:20:00 +0000