Does Window function work in MV (base JavaScript)

Discussion in 'Learning Javascript' started by Milena, Dec 4, 2015.

    Tags:
  1. Milena

    Milena The woman of many questions Veteran

    Messages:
    1,282
    Likes Received:
    106
    Location:
    Ireland
    First Language:
    Irish
    Primarily Uses:
    N/A
    I found a really good site where there are sample animations that you can do with drawing canvases and all the other things about javascript functions. I jumped to it and looked at the examples, but I was wondering if Window, which is originally on js actually works well in MV? like onload, oncancelframe, etc.

    Example:

    if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = (window.cancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelAnimationFrame || window.mozCancelRequestAnimationFrame || window.msCancelAnimationFrame || window.msCancelRequestAnimationFrame || window.oCancelAnimationFrame || window.oCancelRequestAnimationFrame || window.clearTimeout);}If I want to make a game enclosed only in an exe file, would it be that helpful / would it work if the animation is written this way?
     
    #1
  2. Iavra

    Iavra Veteran Veteran

    Messages:
    1,797
    Likes Received:
    856
    First Language:
    German
    The window object still exists, but you shouldn't directly call anything that has to do with the animation frame, since that's what the SceneManager does in the background.
     
    #2
  3. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    I set things to the window object only when you need public API, so doing: 

    window.x = y;then later on:

    x.functionName(arg);Again this is for public user facing API.
     
    #3

Share This Page