dartscale 1.0.2

  • README.md
  • Installing
  • Versions
  • 29

#dartscale Build Status

Is a modular clientside framework for complex applications.

its basicly a slightly altered version of the JavaScript Libray

##Philosophy In traditional MVC Apps, the controllers often have a tight coupling to each other: everyone is accessing each others properties, calls their methods and so on...

This can cause serious problems: if modules depend on each other, the app quickly falls apart if we modify or remove them. Thus quickly leading to an unmaintainable codebase, even in an structured language like Dart where the tools can detect changes in Method/Classnames and signatures.

The Module theory aims to untangle that tight coupling: by seperating the parts of the application into autarc modules and isolating them so they cant actually reference each other, we're getting a rock solid application structure.

This philosophy is well explained in this Talk from Nicholas Zakas

##Features ####no subclassing required Your module classes don't have to subclass any specific framework class. Only a specific constructor and 2 additional methods are necessary.

####easy plugin system The Sandbox object can be easily extended with custom plugins, utilizing Darts noSuchMethod

##Usage ####Creating a Core The Core is the central context for the application, hosting the modules and messagebus.

var core = new Core();

###Subclassing from Core Another option to use the core would be to subclass it

class Application extends Core {
  main () {
    this.register(() => new MyModule(), 'Mymodule');
    this.start('MyModule');
  }
}

main () {
  new Application().main();
}

####Defining a module Modules can be unique or reusable parts of your application and host any functionality you want.
You're not creating them by yourself, the module instances are managed by the Core.

Also their lifecycle is managed by the Core: start is the point where you kick off their functionality, stop is where you shut them down.

The init method is passed a sandbox object through which the module has access to the messagebus (mediator) and the plugins which were registered in the sandbox.

class MyModule {

  Sandbox _sandbox;
  Element _contentEl;
  
  start(options, sandbox) {
    _sandbox = sandbox;
  
    _contentEl = new Element.html(['<div class="module-mymodule">',
      '<h1>No message yet</h1>',
    '</div>'].join(''));
    
    _sandbox.mediator('app', 'greeting').stream.listen((data) {
      _contentEl.query('h1').text = sandbox.CP.composeGreeting(data);
    });
  }
  
  stop() {
    _contentEl.remove();
  }
}

####Registering a module You simply pass a constrcutor function to the register method.

var core = new Core();
core.register(() => new MyModule(), 'MyModule');

####Add sandbox plugins Sandbox plugins can be pretty much anything, from pure functions to entire class instances.

class ComposerPlugin {
  composeGreeting(name) {
    return "Hello Mr./Ms ${name}!";  
  }
}

var sandbox = new Sandbox(new Mediator());
sandbox.registerPlugin("CP", new ComposerPlugin());

print(sandbox.CP.composeGreeting("Marcelus Wallace"))

####Start everything up By starting a single or multiple modules, you start your app.

//pass null to second argument to use the modules name as its Id
core.start('MyModule', options: {
  "container": query(".container")
});

//or

core.startAll({
  "container": query(".container")
});

core.mediator('app', 'greeting').add('Stranger');

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dartscale: "^1.0.2"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dartscale/dartscale.dart';
        
Version Uploaded Documentation Archive
1.0.2 Apr 10, 2014 Go to the documentation of dartscale 1.0.2 Download dartscale 1.0.2 archive
1.0.1 Nov 13, 2013 Go to the documentation of dartscale 1.0.1 Download dartscale 1.0.1 archive
0.1.2 Nov 7, 2013 Go to the documentation of dartscale 0.1.2 Download dartscale 0.1.2 archive
0.1.1 Nov 7, 2013 Go to the documentation of dartscale 0.1.1 Download dartscale 0.1.1 archive
0.1.0 Nov 2, 2013 Go to the documentation of dartscale 0.1.0 Download dartscale 0.1.0 archive
0.0.2 Aug 1, 2013 Go to the documentation of dartscale 0.0.2 Download dartscale 0.0.2 archive
0.0.1 Jul 31, 2013 Go to the documentation of dartscale 0.0.1 Download dartscale 0.0.1 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Jan 21, 2018
  • Dart: 2.0.0-dev.15.0
  • pana: 0.10.0

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
29

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dartscale/dartscale.dart.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dartscale.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
Dev dependencies
unittest >=0.9.0 <0.10.0