@teambit/harmony
TypeScript icon, indicating that this package has built-in type declarations

0.4.7 • Public • Published

Harmony

Harmony is the engine that drives Bit extensibility and composability. It's an abstract extension system indended to make any software extendable and composable.

Harmony takes a "micro-kernel" approach and implements the near-minimum amount of software required to build any JavaScript system from independent components through composition.

Installation

$ bit install @teambit/harmony

Quick start

import { Harmony, Extension } from 'harmony';

@Extensioin
class Person {
  sayHello(name = 'world') {
    return `hello ${name}!`;
  }
}

const person = Harmony.load(Person); 
helloWorld.sayHello(); // returns 'hello world!'

Component composition

DI

class Dude {
  constructor(
    private person: Person
  ) {}

  sayHello() {
    return this.person.sayHello('dude');
  }
};

Harmony.load([Dude]).sayHello(); // echos 'hello dude!'

Hooks

@Extension()
class CLI {
  // @hook('command') commands = Hook.create<Command>();
  static command() {
    return Hook.create<Command>();
  }

  run() {
    const allCommands = this.commands.list(); // outputs all hook subscribers
  }
} 

@Extension()
class Compiler {
  
  @command()
  main() {
    return {
      synopsis: 'compile <path>',
      render: () => <Box></Box>
    };
  }
}

Extension configuration

Extension metadata

API reference

License

Apache License, Version 2.0

Made with ❤ to open software by Team Bit.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.10dev
0.4.760latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.760
0.4.63
0.4.50
0.4.41
0.4.30
0.4.20
0.4.10
0.4.00
0.3.314
0.3.20
0.3.10
0.3.00
0.2.115
0.2.104
0.2.91
0.2.82
0.2.78
0.2.60
0.2.50
0.2.40
0.2.30
0.2.21
0.2.10
0.2.01
0.1.6-dev0
0.1.5-dev1
0.1.3-dev0
0.1.1-dev1
0.1.0-dev1
0.0.250
0.0.240
0.0.230
0.0.220
0.0.21518
0.0.201
0.0.190
0.0.181
0.0.171
0.0.160
0.0.15-dev0
0.0.151
0.0.141
0.0.131
0.0.121
0.0.110
0.0.100
0.0.91
0.0.80
0.0.71
0.0.60
0.0.50
0.0.41
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @teambit/harmony

Weekly Downloads

631

Version

0.4.7

License

Apache-2.0

Unpacked Size

184 kB

Total Files

245

Last publish

Collaborators

  • learn-bit
  • teambit-owner
  • shohamgilad
  • davidfirst
  • lalybar
  • ranm8
  • guysaar
  • itaymendel
  • erezbit
  • joshk2
  • redigma
  • yona007
  • jonisar