Click here to Skip to main content
15,887,353 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: is it possible to get a value from another page using JavaScript language? Pin
Hakan Bulut21-Apr-14 22:27
Hakan Bulut21-Apr-14 22:27 
GeneralRe: is it possible to get a value from another page using JavaScript language? Pin
Blikkies21-Apr-14 22:51
professionalBlikkies21-Apr-14 22:51 
GeneralRe: is it possible to get a value from another page using JavaScript language? Pin
Hakan Bulut22-Apr-14 0:13
Hakan Bulut22-Apr-14 0:13 
GeneralRe: is it possible to get a value from another page using JavaScript language? Pin
Hakan Bulut22-Apr-14 1:08
Hakan Bulut22-Apr-14 1:08 
QuestionRequireJs Pin
Suraj Sahoo | Coding Passion16-Apr-14 9:36
professionalSuraj Sahoo | Coding Passion16-Apr-14 9:36 
AnswerRe: RequireJs Pin
ujjwal shukla16-Apr-14 20:46
ujjwal shukla16-Apr-14 20:46 
GeneralRe: RequireJs Pin
Suraj Sahoo | Coding Passion16-Apr-14 20:59
professionalSuraj Sahoo | Coding Passion16-Apr-14 20:59 
AnswerRe: RequireJs Pin
ujjwal shukla16-Apr-14 22:36
ujjwal shukla16-Apr-14 22:36 
RequireJs is modular script loader, supporting Asynchronous Module Definition (AMD) API. Using this you can declare the dependency of a particular module, and only those scripts are loaded, and not all the dependencies of the project.

Well I have no much experience about MVC minification and bundling, but from what I read, its not the same-
1) Minification- You can achieve minification in javascript by using http://www.minifyjs.com/javascript-compressor/[^] or http://marijnhaverbeke.nl/uglifyjs[^]

2) bundling- Its bundling various js files to one file that is reducing the number of call http://www.sitepoint.com/asp-net-4-5-bundling-and-minification-support/[^] and http://www.monkeyphysics.com/articles/read/16/bundling_javascript.html[^]

3) Requirejs is just about loading script asynchronously, as and when that script is required
You start you application with data-main attribute in the cript loading tag as follows
XML
<script src="/js/vendor/require.js" data-main="/js/main.js"></script>

Then in the main.js you write the require the files needed to start the application.
In this file you can use require.config to declare the configurations for the require, like the paths and shim(for the libraries that do not support AMD like underscore, handlebars etc.
C#
require.config({
    baseUrl:'/js/vendor',
    paths : {
        'models' : '/js/app/models',
        'collections' : '/js/app/collections',
        'views' :'/js/app/views',
        'templates' : '/js/app/pages'
    },
    shim :{
        underscore: {
            exports: '_'
        },
        handlebars : {
            exports : 'Handlebars'
        },
        backbone: {
            deps: ['underscore', 'jquery'],
            exports: 'Backbone'
        }
    }
});


Then you can start the application by using a require block. require block cause the required dependencies to be loaded before execution. require is normally written once at the start of the application, giving the application a initial kick start.

VB
require(
    [
        'app/framework/App',
        'app/framework/HandlebarsUtil'
    ],
    function(App, HandlebarsUtil) {
        'use strict';

        // Register Handlebars helpers
        HandlebarsUtil.registerHelpers();

        // Kick off the application by requiring in the app and starting it
        App.start();
    }
);


in the app.js, and henceforth all other files have define block, where dependencies are listed and the variable name that they would be referred to in that script. the code is written as a function, which returns the object of functions for use in other function, like module pattern.

C#
define(
    [
        'app/framework/AppConfig',
        'app/framework/AppRouter',
        'backbone'
    ],
    function(AppConfig, Router, Backbone) {
        'use strict';

        return {
            start: function start() {

                // Start your master router.

            }
        };
    }
);

GeneralRe: RequireJs Pin
Suraj Sahoo | Coding Passion16-Apr-14 22:41
professionalSuraj Sahoo | Coding Passion16-Apr-14 22:41 
GeneralRe: RequireJs Pin
Sibeesh KV24-Sep-14 18:31
professionalSibeesh KV24-Sep-14 18:31 
GeneralRe: RequireJs Pin
Suraj Sahoo | Coding Passion24-Sep-14 19:28
professionalSuraj Sahoo | Coding Passion24-Sep-14 19:28 
GeneralRe: RequireJs Pin
Sibeesh KV24-Sep-14 21:00
professionalSibeesh KV24-Sep-14 21:00 
AnswerRe: RequireJs Pin
thatraja16-Apr-14 21:32
professionalthatraja16-Apr-14 21:32 
GeneralRe: RequireJs Pin
Suraj Sahoo | Coding Passion16-Apr-14 21:36
professionalSuraj Sahoo | Coding Passion16-Apr-14 21:36 
QuestionGridview fixed header and footer while scrolling Pin
harsha714-Apr-14 4:09
harsha714-Apr-14 4:09 
AnswerRe: Gridview fixed header and footer while scrolling Pin
Anurag Gandhi24-Apr-14 5:29
professionalAnurag Gandhi24-Apr-14 5:29 
AnswerRe: Gridview fixed header and footer while scrolling Pin
sankarsan parida12-May-14 7:23
professionalsankarsan parida12-May-14 7:23 
Questionselecation of image with user prefrence Pin
Member 107387389-Apr-14 23:01
Member 107387389-Apr-14 23:01 
AnswerRe: selecation of image with user prefrence Pin
Tom Marvolo Riddle10-Apr-14 2:55
professionalTom Marvolo Riddle10-Apr-14 2:55 
QuestionRe: selecation of image with user prefrence Pin
ZurdoDev11-Apr-14 6:59
professionalZurdoDev11-Apr-14 6:59 
QuestionPlease help me to transfer data between elements in a web form. Pin Pin
lersmethasakul9-Apr-14 13:10
lersmethasakul9-Apr-14 13:10 
AnswerRe: Please help me to transfer data between elements in a web form. Pin Pin
Richard MacCutchan9-Apr-14 23:32
mveRichard MacCutchan9-Apr-14 23:32 
QuestionRe: Please help me to transfer data between elements in a web form. Pin Pin
ZurdoDev10-Apr-14 1:52
professionalZurdoDev10-Apr-14 1:52 
QuestionDrag and drop database related items Pin
tinaclement9-Apr-14 3:04
tinaclement9-Apr-14 3:04 
AnswerRe: Drag and drop database related items Pin
ZurdoDev10-Apr-14 1:53
professionalZurdoDev10-Apr-14 1:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.