Skip to content

ChildrenOfUr/transmit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transmit

A very simple global message-passing library for dart/js interop, based on custom events.

###API a Service receives all messages created by a following transmit with a matching type

Service(List<String> types, Function target);

transmit(String type, var content);

Example

main() {
  new Service(['pokemon'], choose);
  new Service(['attack'], waterGun);

  // Messages trigger services that contain their types.
  transmit('pokemon', 'Squirtle');
    // => I choose you Squirtle!
  transmit('attack', 'Squirtle');
    // => Squirtle used Water Gun!
}

waterGun(content) {
  print('${content} used Water Gun!');
}

choose(content) {
  print('I choose you ${content}!');
}

About

A dart package for triggering events and managing services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 77.8%
  • HTML 13.9%
  • JavaScript 8.3%