Based on work by Nicholas Zakas
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
CoreModules
TestHelpers
Tests
Core.Address.js
Core.Ajax.js
Core.Communication.js
Core.Controls.js
Core.DataBinding.js
Core.DomManipulation.js
Core.Error.js
Core.ModuleGrouping.js
Core.Navigation.js
Core.Observable.js
Core.OpenPostRequestPage.js
Core.PageData.js
Core.Singleton.js
Core.Storage.js
Core.UrlUtilities.js
Core.js
README.md
Sandbox.js
StackTrace.js
TestModules.js
Util.Timer.js

README.md

Scalable Javascript Architecture

What is this for?

Basically this is an architectural framework that allows modularisation of javascript code. It also encapsulates your base library of choice in order to provide an abstraction, this allows (in certain scenarios) less dependence on the library.

How do I use it?

The library lets you define modules:

Core.register("ModuleA", function (sandbox) {
   return {
      activate: function () {
      },
      destroy: function () {
      }
   };
});

Start modules:

Core.start("ModuleA");

or

Core.startAll();

Stop modules:

Core.stop("ModuleA");

or

Core.stopAll();

Define module groupings:

Core.register("ModuleA", function (sandbox) {
   return {
      activate: function () {
      },
      destroy: function () {
      }
   };
});
Core.register("ModuleB", function (sandbox) {
   return {
      activate: function () {
      },
      destroy: function () {
      }
   };
});
Core.ModuleGrouping.registerGroup({
   name: "MyModuleGrouping",
   startsModules: ["ModuleA, ModuleB"]
});

Start and stop module groupings:

Core.ModuleGrouping.start("MyModuleGrouping");

Define module groupings that depend on other module groupings:

Core.register("ModuleC", function (sandbox) {
   return {
      activate: function () {
      },
      destroy: function () {
      }
   };
});
Core.ModuleGrouping.registerGroup({
   name: "MyNextModuleGrouping",
   dependsOnModuleGroupings: ["MyModuleGrouping"],
   startsModules: ["ModuleC"]
});