bff-lib

0.6.4 • Public • Published

BFF logo, Basic Front-end Foundation Build Status

BFF is a collection of standalone modules, designed with the intent of making it easier to design interactive web applications. It comprises base classes for the MVC pattern (Record, View) but more importantly, generic building blocks for event systems (Event Emitter, Event Listener), inheritance (Extend), collections (List) and DOM manipulation (Patch DOM).

Its ambition is to be a helper library rather than a framework, to be mixed and matched with home grown or third-party components. As such, each BFF module provides a specific service, with a minimal interface. All modules are UMD compatible, which means that they support AMD and CommonJS loaders, as well as no loader at all.

Distinguishing features

  • Modular and without external dependencies.
  • Two versions; development and production. The former with lots of runtime error checking, the latter minified and without error checks, for optimal performance.
  • Fast and fool-proof event system - uses inversion-of-control to automatically keep track of registered event listeners.
  • Data modules (Record and List) combine event system with getters and setters, to create an event emitting, type safe, data layer that can be manipulated with the same syntax as plain JS objects.
  • Data modules support calculated properties, similar to signals in FRP, whose values are derived from one or more other properties - and still emits events when their calculated values change.
  • View module inspired by Backbone.js views, with the addition of React-like DOM patching and hierarchical structuring.

Compatibility

  • Latest versions (and presumably earlier) of Chrome, Firefox, Safari and Opera
  • Internet Explorer 9 and later
  • Node.js (except View and Patch DOM modules, which naturally require a browser environment)

Download

  • Run npm install bff-lib --save or bower install bff-lib --save in your project's root folder
  • Or, download a release directly from here.

Demos

Todo application (source)

Documentation

API reference

Want to contribute?

Building

npm install will install all project dev. dependencies.

grunt will lint the project, build dev and prod versions of BFF, compile JSDoc documentation, and run the Intern test suite

grunt watch will watch for source file changes and recompile the source and documentation

Running tests

Unit tests in browser

Go to [server root]/node_modules/intern/client.html?config=tests/intern in some browser

Unit tests in terminal (Node.js)

Run node_modules/.bin/intern-client config=tests/intern

Unit tests and functional tests in browser
  • Start a standalone Selenium server java -jar [path to selenium jar]
  • Run grunt test

Package Sidebar

Install

npm i bff-lib

Weekly Downloads

1

Version

0.6.4

License

MIT

Last publish

Collaborators

  • oskargustafsson