Friday, September 4, 2015

Advanced JavaScript Topics Part 2

We were discussing the let keyword in the Part 1 of this series. We discussed what the advantages and how we can use let keyword in the code. However, let keyword has a problem it does not support hoisting, means if you have declared a variable using let keyword in the mid of the block it would not be available in the part above the declaration of the let keyword.
So you always make sure that let is declared at the top of the block.
As we discussed earlier let keyword kind of Hack the scope implicitly. We can always write the code to make sure when we see we can explicitly identify that this block is a scope. The example given the in the Part 1 of this series used the implicit way. To use the explicit way do it like this

function foo(bar) {
    "use strict"
    let (test = bar) {
        console.log(test) // "bar"  
    }
    console.log(baz) // reference error
}

However, this syntax is rejected by the committee. we can use some other way to make sure we see the block scope in the code as we read the code.

function foo(bar) {
    "use strict"
    /*let */
    {
        let test = bar
        console.log(test) // "bar"  
    }
    console.log(baz) // reference error
}

This is one way to do it. Keyle Simpson have created this great tool to help you with block scoping it is called Let-er .


So, as we started to talk about tools you might want to take a look at traceur-compiler it generates ES 5 code from ES 6 code. As there is development going on in ES 6 you should start writing your code in ES 6 and use a transpiler to convert the ES 6 code to ES 5. You can use grunt-traceur . Other than this you might wanna take a look at the tools for ES 6.


Hoisting


Hoisting is a concept which is developed to understand how JavaScript works when we declare the variables and functions. Take a look at the code below

Thursday, August 27, 2015

Advanced JavaScript Topics Part 1

If you are writing Hybrid Mobile Applications than JavaScript should in your blood. So, I am trying to write something about JavaScript today.


Some Resources

  • https://github.com/rwaldron/idiomatic.js : It is a write up of idiomatic code that is widely accepted across the developer to write consistent JavaScript code. You may not agree with all the code which is there but it is a great place to start. There are couple of quotes written on the git page, which I like it is
         "Arguments over style are pointless. There should be a          style guide, and you should follow it"                
         Rebecca Murphey
  • http://addyosmani.com/resources/essentialjsdesignpatterns/book/ : This is one stop shop for design patterns in JavaScript and if you are going to write a clean code in JavaScript and Follow a Design to solve the problems in JavaScript you should go through this.

  •     http://www.ecma-international.org/ecma-262/6.0/ : JavaScript is EEMA Script if you don’t know. This is the language specification and I am sure many of you have not referred to this. If you are referring to this means you are writing some serious efficient JavaScript Code.

Sunday, August 16, 2015

How to remove NavBar from Blogger Template

In Blogger we have NavBar at the top of the which gives us access to move around the blogger easily as shown below.


Blogger NavBar
It gives us access to Next Blog and there are more options to share the on different Social Networking sites and also to report as Spam.

However, you believe it or not it does impact the looks of the blog. We can remove the NavBar by editing the NavBar. You can click on Edit on the NavBar Widet and it open up the widget settings.


NavBar Blogger Widget Settings

This is hide the NavBar from the Blogger.

Thursday, August 13, 2015

Introduction to Facebook Parse SDK

Parse was acquired by Facebook in 2013 and they have announced Open Source SDKs. Open Sourced all of SDKs related to iOS, OSX, and Andriod. Code for all the SDKs is available on Github ParsePlatform.

Mobile Developers were using these SDKs for Development but were not aware of what is happening behind the scenes. 

Parse Team has started to write updates about the Parse SDKs on the blog. The very first blog "The Parse SDK : What's inside" tells about how Asynchronous APIs works in Parse.


Parse Asynchronous API



















WKWebView for Hybrid Apps in iOS 8

With the release of iOS 8, Apple has brought so many changes in the Framework existing classes and have introduced new classes.

For Hybrid App development we introduced UIWebView, Which is used for displaying the Web content. 

However, with the release of iOS Apple has introduced a new class called WKWebView. which is derived from UIView here is the inheritance chain for WKWebView.

NSObject
|
UIResponder
|
UIView
|
WKWebView

WKWebView is also derived from UIView similar to UIWebView, So what are the difference in both.


Performance