tlojs
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

TLO.js (The Last One)

TLO.js is the last npm package that you'll have to install. With little to no sub dependencies The goal of this repo is to jam pack it full of handy functions, functionality, etc to get the job done.

Sub Libraries

  • Array
  • Dependency Injection
  • JSON
  • Table
  • Events
  • Logger

Examples

Table Usage

const data = [
  { a: 1, b: 2},
  { a: -1, b: 3}
]

const table = new Table({ data })
table.sort(0, true)
const query = table.select('A:B')

const results = query.exec(Sum)

// Render the table
const renderer = new TableRenderer(table)
renderer.renderTo(document.getElementById('data'))

// Or load the table from a CSV
const csv = `
a,b,c
1,1,1
2,2,2
3,3,3
`;

const table = Table.load(CsvLoader, csv)

Dependency Injection Usage

@Injectable()
class A {
  getNumber() { return 1 }
}

@Injectable()
class B {
  constructor(public a: A) {

  }
}

const service = Injector.resolve<B>(B)

Event and Event Hub Usage

// Define the custom event
class TestEvent extends BaseEvent {
  name = 'Test'
}

// Create a new instance of the event
const ev = new TestEvent()

// Listen to the event
GlobalEventHub.register(TestEvent, (e) => console.log(e))

// Dispatch the event
ev.dispatch()

Package Sidebar

Install

npm i tlojs

Weekly Downloads

10

Version

0.0.11

License

MIT

Unpacked Size

86.6 kB

Total Files

137

Last publish

Collaborators

  • chasewillden