locked
Why two Javascript file base-sdk.js and program.js is Used in the Project Structure. RRS feed

  • Question

  • Hi,

    I wanted to know that, why two files has been creted for the Javascript Projects in the Metro Ui application .i.e ( base-sdk.js and program.js ) its little confusing.

    Instead of that we can achieve the same functionality through the single file also(I guess).

    After looking into the code  i got to know that:

    program.js: Where the main logic of the code is been written.

    base-sdk.js:Where all the display messages like Error and status  are being written.

    Thanks,

    Ldm_Metro

    Friday, April 6, 2012 11:29 AM

Answers

  • These are simply structural artifacts of the SDK samples themselves. base-sdk.js is a file that's common to all the samples and aren't particular to the features being demonstrated, whereas program.js contains the code that's specific to the sample. For your own projects you can structure files however you'd like.

    You'll find that the basic (Blank) app template in visual studio just creates a single default.js for app code. But I've seen many projects structured in many different ways according to the app's architecture and the developer's own preference. There's nothing sacred about the structure of the samples.

    .Kraig

    Friday, April 6, 2012 5:13 PM
  • Hi,

    >Can we just merge the two files base-sdk.js and program.js????

    They are pure js files so you're able to do that. However it does not quite make sense to me. Isn't it better to keep existing structure as the purposes to use them are different? May I know what you're worrying about so you need to merge them?


    Allen Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 9, 2012 8:08 AM

All replies

  • These are simply structural artifacts of the SDK samples themselves. base-sdk.js is a file that's common to all the samples and aren't particular to the features being demonstrated, whereas program.js contains the code that's specific to the sample. For your own projects you can structure files however you'd like.

    You'll find that the basic (Blank) app template in visual studio just creates a single default.js for app code. But I've seen many projects structured in many different ways according to the app's architecture and the developer's own preference. There's nothing sacred about the structure of the samples.

    .Kraig

    Friday, April 6, 2012 5:13 PM
  • Hi Kraig,

    Can we just merge the two files base-sdk.js and program.js????

    I tried merging these two files but i got some compilation errors. so i was little worried whether it is possible or not.

    If possible can you provide me few samples....thanks in advance.

    Regards,

    Ldm_Metro

    Saturday, April 7, 2012 5:23 PM
  • Hi,

    >Can we just merge the two files base-sdk.js and program.js????

    They are pure js files so you're able to do that. However it does not quite make sense to me. Isn't it better to keep existing structure as the purposes to use them are different? May I know what you're worrying about so you need to merge them?


    Allen Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 9, 2012 8:08 AM