Академический Документы
Профессиональный Документы
Культура Документы
Web Browser
(AngularJs,Rea
ctJs,Kockout,S
encha)
Web Server
(Node.js)
Database
(Mongo DB)
Core strength of JS
Functional programming language. ( Lambda expression in JAVA)
( functions are 1st class objects) ES5
Function Employee() { }
Class Employee { } ES 2015
Day 2 session - 1
Modular Programming (Separate out the modules)
AMD Asynchronous model definition
Eg.
<body>
<script>
</script>
</body>
or ES5 manually modules can be loaded using libraries like RequireJS. Helps to
odules asynchronously.
equireJS is an implementer of AMD
setTimeout(fuction() {
----}, 1000;
Class Emp { }
Class Mgr extends Emp { }
ES6
Function Emp { }
Function Mgr { }
Mgr.prototype = Object.create(Emp.prototype);
results in 15
ES5
(OLO
Object
linked
objects)
var prj = {
name : Phoenix,
securityLevel: 15,
updateDate: function() {
return true;
},
}
var prj = {
tasks: [
{
taskName: first
},
{
}
]
};
console.log(prj.tasks[1].taskName);
Understand Prototypes:
Every JS Object has prototype property
Eg.
var prj = anyObj;
prj.someFun();
prj.someFun();
prj.prototype.someFun();
Prototype chaining:
function Emp() { }; Emp.toString = function() { return Hello;}
function Mgr() {}
Mgr.prototype = Object.create(Emp.prototype);
var mgr1 = new Mgr();
console.log(Mgr typ + ( mgr1 instanceof Emp));
JS Inheritance example
var obj = {}
obj.prototype.doSomething = function() { } is not valid
obj.__proto__.doSomething = fucntion() {} is valid due to literal object creatio
Js Patterns
Namespace
MVC
Observer
Modularity
Namespace
var MyApp = MyApp || {} return MyApp if it is
already created otherwise create an empty object
sub objects
Angular JS
MV*
MVC
MVP
MVVM
controller
view
model
observer pattern
( publish / subscribe)
MVP
view
presenter
model
view
data
binding
mode
l
view
controller
view
model
Observer Pattern
Jquery
DOM Manipulation
DOM Iteration
CrossBrowser Compatibility
Event Handling
Ajax
Rich Internet Application (Jquery UI)
src
model
view
controller
model.js
view.js
controller.js
Main
Tasks
Data
storage
Element
Rendering
RequireJs
Eg.
var module = require(module1);
= require(module2);
import * as from module;
NodeJs
Format
ES6 format
require({dependencyArray}, {callbackFunction});
Dependency injection
require([m1, m2], function(m1,m2){..});
CommonJs Wrapper
define([m1, m2], function(m1,m2){..});
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.5/require.js"
data-main="src/main.js"
async="async"></script>
// data-main is a HTML5 specification
HTML-5
Supports touch events, drag&drop for all platforms like desktop, mobile..etc
Semantic markup
HMTL - 4 div is overused these days - from header to footer
New semantics header, footer, nav, aside, section
Rich set of javascript
webstorage(earlier cookies)[ local storage and session storage ]
local storage data is persisted even on close of browser
session storage data is erased on close of browser
also called as dom storage
geolocation api
messaging apis [XHR-XML Http Request Level-2]
used for ajax calls
PPR-Partial Page Rendering
[Polling has disadvtg of unnecessary calls when there is no new data]
[SSE Server Sent Events]
[WebSockets]
FormData , CLOB, BLOB
Plugin less development
New Javascript APIs
Http header : protocol upgrade [ tells the server to switch from http to webso
it became a standard
article
asid
e
Header
canvas
main
article
section
footer
Canvas
Contacts
File Api
IndexedDB
benefits the soft keyboard ( eg. while typing OTP if the input type is number
it shows only the number keyboard )
new validation fields
SS -3 gives an option called media queries to decide the width and hieght
Fluid Layout - web is no longer fixed ( % , em, rem are the measurements)
Fluid Content
Media Queries
mobile
tablet
desktop
Grid System
Header
img
article
services
Footer
long with media , we can use the target like print layout, magazine layout ..etc
less
css preprocessors
( define css more like programming flavors , mostly used is sas
CSS
sass
div {
p{
element {
}
}
div p element1 { }
div p element2 { }
}
using preprocessors
.container or .container-fluid
.row
.col-sm-4
10 11 12
.col-sm-8
when we specify
<div class=container> allows margin and padding
<div class=container-fluid> no margin and padding
eg.
col-sm-8
col-lg-12
header
aside
main
footer
aside