Nunu Class

Module: Runtime

nunuStudio core main file.

Store development version, timestamp and contains global method to check browser feature support.

Methods

copyNamespace

() static

Import stuff from a namespace to another target namespace.

If not target is specified window is used.

createWorker

(
  • code
  • onMessage
)
Worker

Create a web worker from code written in a string.

Uses a blob to inject the code and loads it from and URL object.

Parameters:

  • code String

    Javascript code for this worker.

  • onMessage Function

    On message worker callback.

Returns:

Worker:

Returns a worker instance (for comunication).

getPlatform

() Number

Check in wich platform the enviroment is running.

Possible return values are:

  • Nunu.NWJS
  • Nunu.BROWSER
  • Nunu.CORDOVA

Returns:

Number:

Indicates the platform type.

getQueryParameters

() Object

Get the query parameter from the browser URL.

Returns:

Object:

Object with parameters read from the URL.

isFullscreen

() Boolean

Check if there is some element on fullscreen mode.

Returns true even the fullscreen element is not related with the app.

Returns:

Boolean:

True if there is some element in fullscreen mode.

openWebpage

()

Open a webpage on a new window.

On desktop and mobile it will open the default browser.

On the web it will open as a popup.

runningOnDesktop

() Boolean

Check if app is running inside NWJS.

Returns:

Boolean:

True if running inside NWJS

setFullscreen

(
  • fullscreen
  • element
)

Set an element into fullscreen mode or exit out of fullscreen mode.

Uses isFullscreen to check if the application is running in fullscreen mode already.

Parameters:

  • fullscreen Boolean

    If true the application will enter fullscreen mode, if false it will exit, if undefine it will toggle the value.

  • element Component

    DOM element to put into fullscreen.

webAudioAvailable

() Boolean

Check if host supports WebAudio.

Returns:

Boolean:

True if WebAudio is available.

webglAvailable

() Boolean

Check if host supports WebGL, only checks for WebGL 1.0 support.

Returns:

Boolean:

True if WebGL is available.

Attributes

BROWSER

Number static

Running inside of a regular web browser.

CORDOVA

Number static

Cordova platform, used for mobile versions.

DEVELOPMENT

Boolean static

Indicates if the application/library is being used in development mode.

Can be usefull to restrict development functionality when building to production.

NAME

String

Aplication name (might be usefull if getting the module as a unnamed export)

Default: "nunuStudio"

NWJS

Number static

NWJS platform, used for desktop version.

REPOSITORY_BRANCH

String static

Repository branch, used to track the version after publishing.

REPOSITORY_COMMIT

String static

Repository commit uuid, used to track the version after publishing.

TIMESTAMP

String

Stores the timestamp of the application build.

VERSION

String

Stores the runtime version.