Total.js Platform
Total.js Platform

Total.js Platform news and tutorials

New Total.js version 2.4

New Total.js version 2.4

New Year brings a new version of Total.js framework v2.4. The framework is awesome tool for creating web applications, e-commerce, REST services, Internet of Things or desktop web applications running on Electron.

I have created more than 200 Total.js projects over last 4 years. Most of the projects is still up and running with great results. Give Total.js a try if you are new to Node.js, it's easy to start with.

NEW: Reusable Components

I have added a great new feature called components. Components are server-side reusable components which can contain CSS, JS and HTML in single file. The framework parses each component and splits CSS + JS to separate static files which will be merged and compiled. The framework processes HTML content as a classic view (the component has access to all view commands).

  • supports a localization markup e.g. @(Join our newsletter)
  • supports server-side scripting
  • supports (almost) all commands from views
  • CSS and JS are compiled
  • HTML is minified
  • IMPORTANT: download latest version of debug.js

Directory structure:

File structure of components:

Component /components/newsletter.html:

Usage in views - /views/myview.html:

Then the framework renders CSS/JS links into the @{head} / @{import('head', ...)} tag when the view contains some components.

Convertors

Convertors are really helpful for converting values e.g. from String to Number when a QueryString (GET/POST+PUT+DELETE form-urlencoded) is parsed.

Create a definition file: convertors.js:

Some controller:

Operations

The operations are registered asynchronous functions with a better error handling via ErrorBuilder (similar to schemas).

Benefits:

  • error handling
  • simple and async usage
  • global access
  • a same usage like operations in Schemas

Registering operations:

Calling operations:

Up-To-Date

This feature downloads and evaluates specific Total.js dependencies (controllers, modules, etc.). It uses same functionality like INSTALL() method but with additional interval argument.

Create a definition file uptodate.js:

Up-To-Date behaviour can also be used in /dependencies file:

How to create e.g. up-to-date module?

  • create a module e.g. mymodule.js
  • upload your module on your server
  • link your module with your app UPTODATE('module', 'https://..../mymodule.js', '20 minutes')
  • IMPORTANT: framework cleans routes (F.route(), F.file() or F.websocket()) automatically

Content of mymodule.js:

Configuration files support custom options for dependencies

  • options is used in these methods: INSTALL() and UPTODATE()
  • and in all dependencies when they are loaded

E.g. /config:

ShellSort replaces QuickSort algorithm

I have performed some tests with sorting algorithms and ShellSort is about 10-15% faster than QuickSort. Note: NoSQL embedded database uses this new sorting algorithm.

X-Powered-By header

I have added back the X-Powered-By header with Total.js value (but without Total.js version). You can disable this behaviour via Total.js configuration file:

String.parseTerminal()

I have added a new String prototype String.parseTerminal([fields], fnLine(values, index, length, realIndex), [skip], [take]) for parsing terminal output.

New alias for GETSCHEMA()

I have added a new alias for GETSCHEMA() method, the new alias is $$$([group], name) and it's more readable (for me). So you can choose what is better for you:

Improved scripting

I have improved F.script() and now it can return a compiled function.

Mail Message supports unsubscribe method

The method adds List-Unsubscribe header.

New Year's cleaning

  • Removed restrictions (this feature can be created via middleware)
  • Removed behaviours (it wasn't as useful as expected)

Improvements

  • Better performance.
  • Improved compression of CSS files.
  • A framework codebase has been optimized and decreased in size by about 8 kB.
  • The framework is ready for Node v7.
  • F.datetime has a better lifecycle.
  • Improved memory consumption in controller.memorize() and F.localize().

Fixes

  • A critical bug with authorization (authorize and unauthorize flags) in WebSocket
  • JS minificator
  • Fixed streaming cache in a debug mode

Chat support $70 for 3 months

I'd like to help to answer your questions about Total.js platform, development, solving issues, etc.. All earned money will be used for Total.js platform and its products. Chat is provided by Hangouts, Gitter or Slack.

Become a sponsor

Total.js website has more than 13 K unique visitors per month and I offer you a great promoting of your company on Total.js homepage, in the partner's section and in all GitHub readme's files. Support the framework, become a sponsor. If you are interested, please contact info@totaljs.com.