• Stars
    star
    1,560
  • Rank 28,853 (Top 0.6 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED - A minimal component-based JavaScript framework

Build Status Project Status

DEPRECATED

Box has migrated using react, webpack, and the latest version of ECMAScript for our frontend projects as of 2018. We no longer support changes, pull requests, or upgrades to this package. We appreciate all of the user contributions that you have given us over the past few years.

T3 JavaScript Framework

T3 is a client-side JavaScript framework for building large-scale web applications. Its design is based on the principles of Scalable JavaScript Application Architecture, specifically:

  • Enforcing loose coupling between components
  • Making dependencies explicit
  • Providing extension points to allow for unforeseen requirements
  • Abstracting away common pain points
  • Encouraging progressive enhancement

The approaches taken in T3 have been battle-hardened through continuous production use at Box since 2013, where we use T3 along with jQuery, jQuery UI, and several other third-party libraries and frameworks.

Framework Design

T3 is different from most JavaScript frameworks. It's meant to be a small piece of an overall architecture that allows you to build scalable client-side code.

No MVC Here

T3 is explicitly not an MVC framework. It's a framework that allows the creation of loosely-coupled components while letting you decide what other pieces you need for your web application. You can use T3 with other frameworks like Backbone or React, or you can use T3 by itself. If you decide you want model and views, in whatever form, you can still use them with T3.

Unopinionated by Design

T3 is made to be unopinionated while prescribing how some problems might be solved. Our goal here is not to create a single framework that can do everything for you, but rather, to provide some structure to your client-side code that allows you to make good choices. Then, you can add in other libraries and frameworks to suit your needs.

Three Component Types

T3 allows you to define functionality using just three component types:

  1. Services are utility libraries that provide additional capabilities to your application. You can think of services as tools in a toolbox that you use to build an application. They intended to be reusable pieces of code such as cookie parsing, Ajax communication, string utilities, and so on.
  2. Modules represent a particular DOM element on a page and manage the interaction inside of that element. It's a module's job to respond to user interaction within its boundaries. Your application is made up of a series of modules. Modules may not interact directly with other modules, but may do so indirectly.
  3. Behaviors are mixins for modules and are used primarily to allow shared declarative event handling for modules without duplicating code. If, for instance, you use a particular attribute to indicate a link should use Ajax navigation instead of full-page navigation, you can share that functionality amongst multiple modules.

We've found that by using a combination of these three component types, we're able to create compelling, progressively-enhanced user experiences.

Installation

To include T3 in a web page, you can use RawGit.

The last published release:

<!-- Recommended: Latest version of T3 -->
<script src="https://cdn.rawgit.com/box/t3js/v2.7.0/dist/t3.js"></script>

<!-- Recommended: Latest minified version of T3 -->
<script src="https://cdn.rawgit.com/box/t3js/v2.7.0/dist/t3.min.js"></script>

<!-- jQuery version (IE8 + 1.8.0+ jQuery) -->
<script src="https://cdn.rawgit.com/box/t3js/v2.7.0/dist/t3-jquery.js"></script>

<!-- jQuery minified version (IE8 + 1.8.0+ jQuery) -->
<script src="https://cdn.rawgit.com/box/t3js/v2.7.0/dist/t3-jquery.min.js"></script>

You may also use bower to install t3js:

bower install t3js

Upgrade from 1.5.1 to 2.0.0

T3 2.0.0 was released on November 18th, 2015 with some major changes. To upgrade, please see these instructions.

Getting Started

Your T3 front-end is made up of modules, so the first step is to indicate which modules are responsible for which parts of the page. You can do that by using the data-module attribute and specifying the module ID, such as:

<div data-module="header">
    <h1>Box</h1>
    <button data-type="welcome-btn">Show Welcome</button>
</div>

This example specifies the module header should manage this particular part of the page. The module header is then defined as:

Box.Application.addModule('header', function(context) {

    return {

        onclick: function(event, element, elementType) {
            if (elementType === 'welcome-btn') {
                alert('Welcome, T3 user!');
            } else {
                alert('You clicked outside the button.');
            }
        }

    };

});

This is a very simple module that has an onclick handler. T3 automatically wires up specified event handlers so you don't have to worry about using event delegation or removing event handlers when they are no longer needed. The onclick handler receives a DOM-normalized event object that can be used to get event details. When the button is clicked, a message is displayed. Additionally, clicking anywhere inside the module will display a different message. Event handlers are tied to the entire module area, so there's no need to attach multiple handlers of the same type.

The last step is to initialize the T3 application:

Box.Application.init();

This call starts all modules on the page (be sure to include both the T3 library and your module code before calling init()). We recommend calling init() as soon as possible after your JavaScript is loaded. Whether you do that onload, earlier, or later, is completely up to you.

There are more extensive tutorials and examples on our website.

Browser Support

T3 is tested and known to work in the following browsers:

  • Internet Explorer 9 and higher
  • Firefox (latest version)
  • Chrome (latest version)
  • Safari (latest version)

With the exception of Internet Explorer, T3 will continue to support the current and previous one version of all major browsers.

Contributing

The main purpose of sharing T3 is to continue its development, making it faster, more efficient, and easier to use.

Directory Structure

  • config - configuration files for the project
  • dist - browser bundles (this directory is updated automatically with each release)
  • lib - the source code as individual files
  • tests - the test code

Prerequisites

In order to get started contributing to T3, you'll need to be familiar and have installed:

  1. Git
  2. npm
  3. Node.js or IO.js

Setup

Following the instructions in the contributor guidelines to setup a local copy of the T3 repository.

Once you clone the T3 git repository, run the following inside the t3js directory:

$ npm i

This sets up all the dependencies that the T3 build system needs to function.

Note: You'll need to do this periodically when pulling the latest code from our repository as dependencies might change. If you find unexpected errors, be sure to run npm i again to ensure your dependencies are up-to-date.

Running Tests

After that, you can run all tests by running:

$ npm test

This will start by linting the code and then running all unit tests.

Build Commands

The following build commands are available:

  1. npm test - runs all linting and uni tests
  2. npm run lint - runs all linting
  3. npm run dist - creates the browser bundles and places them in /dist

Frequently Asked Questions

Can I use this with older browsers?

We provide a custom version of T3 built with jQuery that is compatible with older browsers such as IE8.

Why support IE8?

The Box web application currently supports IE8 with a planned end-of-life of December 31, 2015. We will be dropping T3 support for IE8 at the same time.

Support

Need to contact us directly? Email [email protected] with your questions or comments.

Copyright and License

Copyright 2015 Box, Inc. All rights reserved.

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

http://www.apache.org/licenses/LICENSE-2.0

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.

More Repositories

1

spout

Read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
PHP
4,194
star
2

Anemometer

Box SQL Slow Query Monitor
JavaScript
1,369
star
3

kube-applier

kube-applier enables automated deployment and declarative configuration for your Kubernetes cluster.
Go
627
star
4

kube-iptables-tailer

A service for better network visibility for your Kubernetes clusters.
Go
538
star
5

box-ui-elements

React Components for Box's Design System and Pluggable Components
JavaScript
532
star
6

box-python-sdk

Box SDK for Python
Python
407
star
7

mojito

An automation platform that enables continuous localization.
Java
354
star
8

flaky

Plugin for nose or pytest that automatically reruns flaky tests.
Python
347
star
9

viewer.js

A viewer for documents converted with the Box View API
JavaScript
335
star
10

stalker

A jQuery plugin allowing elements to follow the user as they scroll a page.
JavaScript
227
star
11

boxcli

A command line interface for interacting with the Box API.
JavaScript
197
star
12

box-windows-sdk-v2

Windows SDK for v2 of the Box API. The SDK is built upon .NET Framework 4.5
C#
186
star
13

ClusterRunner

ClusterRunner makes it easy to parallelize test suites across your infrastructure in the fastest and most efficient way possible.
Python
180
star
14

box-node-sdk

A Javascript interface for interacting with the Box API. You can find the node package at
JavaScript
177
star
15

augmented_types

A PHP extension to enforce parameter and return type annotations
C++
166
star
16

bart

A collection of our critical PHP tools
PHP
163
star
17

box-java-sdk

The Box SDK for Java.
Java
153
star
18

memsniff

A tool for recording and displaying statistics on memcached traffic written in golang.
Go
143
star
19

genty

Genty, pronounced "gen-tee", stands for "generate tests". It promotes generative testing, where a single test can execute over a variety of input.
Python
119
star
20

box-ios-sdk

iOS SDK for the Box Content API
Swift
117
star
21

kube-exec-controller

An admission controller service and kubectl plugin to handle container drift in K8s clusters
Go
109
star
22

RainGauge

RainGauge
JavaScript
107
star
23

leche

DEPRECATED - Testing extensions for Mocha and Sinon
JavaScript
103
star
24

box-content-preview

JavaScript library for rendering files stored on Box
JavaScript
100
star
25

box-openapi

OpenAPI 3.0 Specification for the Box APIs
JavaScript
92
star
26

rotunicode

Python library for converting between a string of ASCII and Unicode chars maintaining readability
Python
77
star
27

brainy

A faster, safer templating library for PHP
PHP
66
star
28

mysqlutilities

Box's MySQL Utilities
Shell
65
star
29

samples

Code snippets and samples to demonstrate how to get the most out of the Box platform & API
JavaScript
64
star
30

box-android-sdk

Java
62
star
31

box-android-apptoapp-sdk

This SDK supports Box OneCloud integrations on Android that handle file β€˜roundtrips’. That is, it enables file open-edit-save scenarios between the Box app and partner apps without the need for partner apps to authenticate a Box user independently.
Java
57
star
32

box-salesforce-sdk

This is the Salesforce SDK for integrating with the Box Platform.
Apex
53
star
33

fast_assert

PHP
37
star
34

StatusWolf

Configurable operations dashboard designed to bring together the disparate datasources that operations teams need to manage and present them in a flexible and beautiful way.
PHP
36
star
35

shmock

SHorthand for MOCKing in PHPUnit
PHP
34
star
36

Makefile.test

A makefile used for running test executables
Python
32
star
37

error-reporting-with-kubernetes-events

A demonstration of how Box utilizes Kubernetes CustomResourceDefinitions and Events
Go
32
star
38

box-skills-kit-nodejs

Official toolkit library and boilerplate code for developing Box Skills.
JavaScript
27
star
39

shalam

DEPRECATED - A friendly tool for CSS spriting
JavaScript
25
star
40

developer.box.com

Box Developer Documentation - Content & Configuration
JavaScript
23
star
41

box-ios-browse-sdk

Objective-C
18
star
42

wavectl

Command Line Client For Wavefront
Python
18
star
43

box-ios-preview-sdk

Box iOS Preview SDK
Swift
17
star
44

clusterrunner-javascript-sdk

ClusterRunner JavaScript SDK that works in both node and browsers
HTML
16
star
45

box-ui-elements-demo

Demo react app for UI Elements
JavaScript
14
star
46

box-python-sdk-gen

Repository for generated Box Python SDK
Python
14
star
47

sdks

SDKs, CLI and other tools for using Box Platform
14
star
48

box-android-preview-sdk

Box Android Preview SDK
Java
13
star
49

box-android-browse-sdk

Java
12
star
50

hdrCompressor

Tool for saving HDR file as RGBM, RGBD, RGBE or LogLuv TGA file.
C
12
star
51

box-typescript-sdk-gen

Repository for generated Box TS SDK
TypeScript
11
star
52

box-annotations

JavaScript library for annotations on files rendered with Box Content Preview
TypeScript
11
star
53

etcdb

Etcd PEP 249 driver.
Python
10
star
54

box-content-preview-demo

Demo React App using the Preview UI Element
JavaScript
8
star
55

box-postman

The official Box Postman Collection
JavaScript
7
star
56

verold.github.io

Verold developer docs and tutorials
JavaScript
5
star
57

box-ios-share-sdk

Objective-C
4
star
58

box-windows-metadata-sdk-v2

Box Metadata C# SDK Plugin
C#
4
star
59

box-dotnet-sdk-gen

Repository for Box .NET autogenerated SDK
C#
4
star
60

uploaders

Write your own custom uploader to send 3D models/textures to Verold Studio.
4
star
61

homebrew-mojito

Homebrew tap for Box/mojito
Ruby
3
star
62

box-developer-changelog

Box Developer Changelog
JavaScript
3
star
63

box-java-sdk-samples

Sample apps for the Box Java SDK.
Java
2
star
64

box-languages

Languages used by other box projects
JavaScript
2
star
65

box-android-share-sdk

Java
2
star
66

puppet-clusterrunner

Installs ClusterRunner using Puppet
Puppet
2
star
67

cla

Landing page for CLA Agreements
1
star