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.
- Array
- Dependency Injection
- JSON
- Table
- Events
- Logger
- String
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)
@Injectable()
class A {
getNumber() { return 1 }
}
@Injectable()
class B {
constructor(public a: A) {
}
}
const service = Injector.resolve<B>(B)
// 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()