feat(core): enable dev mode by default

BREAKING CHANGE

Before

Previously Angular would run in dev prod mode by default, and you could enable the dev mode by calling enableDevMode.

After

Now, Angular runs in the dev mode by default, and you can enable the prod mode by calling enableProdMode.
This commit is contained in:
vsavkin
2015-12-15 08:34:44 -08:00
parent de996ec50b
commit 3dca9d522a
20 changed files with 77 additions and 40 deletions

View File

@ -43,30 +43,27 @@ export function getTypeNameForDebugging(type: Type): string {
export var Math = _global.Math;
export var Date = _global.Date;
var _devMode: boolean = !!_global.angularDevMode;
var _devModeLocked: boolean = false;
var _devMode: boolean = true;
var _modeLocked: boolean = false;
export function lockDevMode() {
_devModeLocked = true;
export function lockMode() {
_modeLocked = true;
}
/**
* Enable Angular's development mode, which turns on assertions and other
* Disable Angular's development mode, which turns off assertions and other
* checks within the framework.
*
* One important assertion this enables verifies that a change detection pass
* One important assertion this disables verifies that a change detection pass
* does not result in additional changes to any bindings (also known as
* unidirectional data flow).
*
* {@example core/ts/dev_mode/dev_mode_example.ts region='enableDevMode'}
*/
export function enableDevMode() {
// TODO(alxhub): Refactor out of facade/lang as per issue #5157.
if (_devModeLocked) {
export function enableProdMode() {
if (_modeLocked) {
// Cannot use BaseException as that ends up importing from facade/lang.
throw 'Cannot enable dev mode after platform setup.';
throw 'Cannot enable prod mode after platform setup.';
}
_devMode = true;
_devMode = false;
}
export function assertionsEnabled(): boolean {