App

APIApp

Source

app.config

Type:
Object
Default value:
{}

Config object from the package.json file.

Can be overriden in the init.js file.

type

The app type (the default one) uses renderer on the client side.

The game type uses special renderer (if exists) focused on more performance goals.

The text type always return HTML document with no renderer on the client side. It's used for the crawlers (e.g. GoogleBot) or browsers with no javascript support.

// package.json
{
    "name": "neft.io app",
    "version": "0.1.0",
    "config": {
        "title": "My first application!",
        "protocol": "http",
        "port": 3000,
        "host": "localhost",
        "language": "en",
        "type": "app"
    }
}
// init.js
module.exports = function(NeftApp) {
    var app = NeftApp({ title: "Overridden title" });
    console.log(app.config);
    // {title: "My first application!", protocol: "http", port: ....}
};

Source

app.networking

Type:
Networking

Standard Networking instance used to communicate with the server and to create local requests.

All routes created by the App.Route uses this networking.

HTTP protocol is used by default with the data specified in the package.json.

Source

app.styles

Type:
Object
Default value:
{}

Files from the styles folder as Functions ready to create new Items.

Source

app.components

Type:
Object
Default value:
{}

Files from the components folder as the Document instances.

Source

app.resources

Type:
Resources

Source

app.onReady()

Type:
Signal

Called when all modules, components, styled etc. have been loaded.

Source

app.cookies

Type:
Dict

On the client side, this object refers to the last received cookies from the networking request.

On the server side, this cookies object are added into the each networking response.

By default, client has clientId and sessionId hashes.

app.cookies.onChange(function(key){
    console.log('cookie changed', key, this[key]);
});
<h1>Your clientId</h1>
<em>${context.app.cookies.clientId}</em>

Source