Skip to content

Instantly share code, notes, and snippets.

@garryyao
Last active August 29, 2015 14:09
Show Gist options
  • Save garryyao/8d69e144f3e0ee929866 to your computer and use it in GitHub Desktop.
Save garryyao/8d69e144f3e0ee929866 to your computer and use it in GitHub Desktop.
TroopJS 3.0 Compatibility Guideline

TroopJS 3.0 Compatibilities Guide

The following document summarise the list of compatibility issues found on [3.0](https://github .com/troopjs/troopjs/releases/tag/3.0.0-pr.2%2Bfa7fcdb) compare with the last [2.x](https://github .com/troopjs/troopjs/releases/tag/2.0.5%2B01ab95d) build:

modules

generally we have done moved many internal/api-level modules in this version, the following map (non-exclusive) reflects changes that have been made from 2.x to 3.x:

{
	'troopjs-core/net': 'troopjs-contrib-browser/net',
	'troopjs-core/logger': 'troopjs-contrib-browser/logger',
	'troopjs-browser/mvc/controller': 'troopjs-contrib-browser/mvc/controller',
	'troopjs-utils/unique': 'troopjs-util/unique',
	'troopjs-core/component/factory': 'troopjs-compose/mixin/factory',
	'troopjs-utils/merge': 'troopjs-util/merge',
	'troopjs-core/logger/console': 'troopjs-contrib-browser/logger/console',
	'troopjs-browser/loom/config': 'troopjs-dom/loom/config',
	'troopjs-utils/getargs': 'troopjs-util/getargs',
	'troopjs-browser/loom/unweave': 'troopjs-dom/loom/unweave',
	'troopjs-utils/defer': 'troopjs-util/defer',
	'troopjs-browser/route/uri': 'troopjs-contrib-browser/net/uri',
	'troopjs-browser/loom/weave': 'troopjs-dom/loom/weave',
	'troopjs-browser/loom/woven': 'troopjs-dom/loom/woven',
	'troopjs-browser/loom/plugin': 'troopjs-dom/loom/plugin',
	'troopjs-browser/component/widget': 'troopjs-dom/component/widget',
	'troopjs-browser/application/widget': 'troopjs-dom/application/widget',
	'troopjs-browser/hash/widget': 'troopjs-dom/hash/widget',
	'troopjs-data/store/component': 'troopjs-opt/store/component',
	'troopjs-data/component/widget': 'troopjs-dom/component/widget'
	'troopjs-requirejs/template': 'mu-template/plugin'
}

core

Since troopjs-core/logger/pubsub is now gone, and is now replaced with the corresponding component-level methods, a compact module is needed for component that consume it, e.g. troopjs-ef/component/ef

Since components are now self-registering, the way how troopjs-core/component/registry has changed, all usages of that have to be reviewed, e.g. troopjs-ef/service/registry.

Memorized event methods troopjs-core/component/gadget#republish and troopjs-core/component/gadget#remit are now removed, compact methods have to be provided and marked as deprecated, suggesting the developer to use troopjs-core/component/gadget#peek instead.

Restart a component by troopjs-core/component/gadget#start which is already started, now doesn't fail as before, developer shall be warned for potentially error prune occurrence, same case applies for the #stop method.

widget

Widget constructor of troopjs-dom/component/widget now requires a mandatory $element first argument, which is optional in 2.x versions, this makes all "fake widget" - widgets that are used as gadget, fails loudly.

Due to the underneath DOM event handlers delegation implementation has changed, not all CSS3 selectors are supported for matching, developers using unsupported CSS3 selector usage shall throw errors upon event registration.

Jquery plugins of loom are not anymore loaded as default, explicitly require this module is required to have $.fn.weave and $.fn.unweave on jQuery objects.

Method troopjs-dom/component/widget#unweave has now changed to only unweave the children, rather than including the element itself, as it was before, developer shall be warned if this method is called a living widget.

controller

The MVC controller widget, troopjs-browser/mvc/controller/widget, other than the module relocation, has the following API breaking changes:

  • hub/controller/request -> controller/widget#request for requesting a new dispatch, which put constraints on only the controller component itself shall issue route requests rather than every other widgets on the page, developer are free to create their only hub events for requesting route changes.
  • request -> event on/request for receiving new requests
  • update -> event on/update for receiving new updates
  • result -> event on/result for get notified of final results

3rd dependencies

poly

You shall receive no breaking change from poly when upgrading to 3.0.

when.js

As we have upgraded to when.js#^3.0, breaking changes are exclusively documented on the [when.js migration guide] (https://github.com/cujojs/when/blob/master/docs/api.md#upgrading-to-30-from-2x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment