JavaScript Archives - Ashish Singh

  • How to write JavaScript Library

    So ever wondered writing own JavaScript library ? yes? so this post is for you. In this article I’ll show you some very simple way to start off writing own javascript library moreover the pattern of modularizing the code. So lets start with some initial boilerplate. var Demo = (function(){ //All codes goes here… function […]

    Read More
  • Detecting Geolocation With JavaScript

    All modern browsers are capable of detecting their own location either by GPS, WiFi or ip addresses. Geolocation is much more accurate for modern devices with GPS, like iPhone and Android. In this post we’re going to see some easy and pure javascript code for detecting geolocation without depending on any third party library or […]

    Read More
  • Vis Js as Vue Js’ Component

    Posts in this seriesVis Js as Vue Js’ ComponentThis blog is all about creating Vis Timeline as Vue‘s component. First of all, Vue.js is a MVVM ( Model View – View Model ) framework which is intuitive, fast and composable for building interactive interfaces. And Vis Timeline is great library to creating timeline and timetable […]

    Read More
  • Scopes and Closures in JavaScript

    Scope Scope controls the visibility and lifetimes of variable and parameters. Most programing languages have block scope that is all variables defined in a block { … } are not visible from outside of the block. The good thing is variables defined in a block can be released when execution of the block finished but […]

    Read More
  • Simple Realtime Notification System Using PHP, Node and Socket.io

    A simple Realtime Notification System using PHP, NodeJS and Socket.io. Requirements PHP Node Js It will be helpful if your application is on native php and want to implement Realtime Notification System using node and socket.io Directory Structure . +–_ajax +–insertNewMessage.php //For inserting new Message or Notification +–readNotification.php //For Marking the notification read +–_class +–Database.class.php […]

    Read More
  • A javascript class that allows us to register several different functions to execute a single common callback function

    The purpose of the class is to execute all the registered functions asynchronously and then, once all of them are finished, It should execute the defined callback function. (function() { function Batch(functions, completionHandler) { this._functions = functions; this._completionHandler = completionHandler; } Batch.prototype.execute = function execute() { var i; var functions = this._functions; var length = […]

    Read More