Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@telekom/tjs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telekom/tjs

Lightweight JavaScript structure framework.

latest
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

tjs

Lightweight JavaScript structure framework.

build

Building is done with the help of UglifyJS. A ready-to-use "production ready" version can be found inside the dist folder.

npm run build

test

Tests are realized with the help of Jasmine and Karma and can be executed via CLI.

npm run test

component

The structure of a component is not completely fixed, but there are some restrictions and a recommended structure definitely exists, so here is a documentation of it.

// each component needs a name for reference and optionally
// a list of dependency names of other components. these
// dependent components are then provided by the $wire argument.
T.add('Component', ['Dependency'], function ($wire) {
   
    // the constructor function is either called during initialization
    // phase (DOMContentLoaded) or on demand if the component is requested
    // manually, but never more than once.
    var $construct = function () {
        $private.method();
        return $public;
    };
    
    // the private object is secured by the closure context and
    // can not be accessed from outside the component instance.
    var $private = {
        method: function () {
            $wire['Dependency'].method();
        }
    };
    
    // the public object will be returned by the constructor function
    // and is thereby accessible if the component is requested.
    var $public = {
        method: function () {
            $private.method();
        }
    };
    
    // returns the public object as the instance.
    return $construct();
    
});

// request a component manually by its name reference. returns
// either the existing instance or builds a new one on demand.
T.get('Component').method();

example

Example components can be found inside the example folder to show off the recommended structure. If the provided HTML page is called with the special query parameter debug (?debug for example), some informative log messages are printed to the browser console.

FAQs

Package last updated on 28 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts