TV Application Framework configuration library.


Node.js backend library and connect middleware to serve your TAL application quickly.


npm install --save tal


The express 4.x middleware will automatically update the HTTP response MIME-Type as well as populating a res.locals.tal object (see below).

// in app.js 
var app = express();

A TAL application requires an Application ID, and this can be set either as an option to the middleware function:

app.use(require('tal').middleware({ application_id: 'testapp' });

or in your package.json file:

"tal": {
  "default": {
    "application_id": "testapp"

This object is populated for each HTTP request connected to the TAL middleware. It contains the following fields, and are tailored for the requesting TV device:

  • app_id: the TAL Application ID used to alias RequireJS path
  • doctype: the relevant HTML doctype string
  • rootTag: the relevant HTML opening <html> tag string
  • deviceHeaders: the relevant HTML Http-Equiv tags string
  • deviceBody: the relevant additional HTML tags string to be added after an opening <body> tag
  • config: a JavaScript object containing the deviceConfig required by the frontend TAL framework to operate

This example is using handlebars to illustrate how to bootstrap a TAL application:

// in layout.hbs
    var antie = {{{json tal.config compact=true}}};
    var require = {
      baseUrl: "",
      paths: {
        '{{tal.app_id}}': 'js',
        antie : "/path/to/tal/static/script"
      priority: [],
      callbackfunction() {}
<div id="static-loading-screen">{{{ body }}}</div>
<div id="app" class="display-none"></div>
<script src="/path/to/requirejs/require.js"></script>
<script src="/path/to/your/talApp/init.js"></script>

In case you would like to tailor a specific use case, you can use the TAL helpers to build your own middleware or HTTP API.

var tal = require('tal').helpers;
var helpers = new tal();

The device config is provided by the tal-config package. See below how to override it and inject your own configuration package.

var deviceConfig = helpers.getDeviceConfigFromRequest({ brand: 'panasonic', model: 'tv_2013' });

From that point you can retrieve any device specific configuration, including the frontend TAL configuration object.

See the API more in details in the sourcecode.

Simply provide a module respecting the tal-config signature to the helper constructor.

var tal = require('tal').helpers;
var talConfig = require('./my/private/tal-config.js');
var helpers = new tal(talConfig);


Simply run the tests using the following command.

npm test

If you add a feature and don't have any knowledge in testing, propose your code anyway. Explain what you want to achieve, what are the edge cases and we'll do our best to fill the blanks.


Copyright 2014 British Broadcasting Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.