mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Compare commits
4 Commits
ionic-modu
...
FW-6458
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f57768a86 | ||
|
|
ec1e7e9c64 | ||
|
|
9b982bcbde | ||
|
|
cc389c0f43 |
@@ -8,7 +8,7 @@ export { getTimeGivenProgression } from './utils/animation/cubic-bezier';
|
||||
export { createGesture } from './utils/gesture';
|
||||
export { initialize } from './global/ionic-global';
|
||||
export { componentOnReady } from './utils/helpers';
|
||||
export { LogLevel } from './utils/logging';
|
||||
export { LogLevel, printIonError, printIonWarning } from './utils/logging';
|
||||
export { isPlatform, Platforms, PlatformConfig, getPlatforms } from './utils/platform';
|
||||
export { IonicSafeString } from './utils/sanitization';
|
||||
export { IonicConfig, getMode, setupConfig } from './utils/config';
|
||||
|
||||
@@ -13,6 +13,7 @@ export const enum LogLevel {
|
||||
* @param message - The string message to be logged to the console.
|
||||
*/
|
||||
export const printIonWarning = (message: string, ...params: any[]) => {
|
||||
console.log('printIonWarning', config.get('logLevel'));
|
||||
const logLevel = config.get('logLevel', LogLevel.WARN);
|
||||
if ([LogLevel.WARN].includes(logLevel)) {
|
||||
return console.warn(`[Ionic Warning]: ${message}`, ...params);
|
||||
@@ -27,6 +28,7 @@ export const printIonWarning = (message: string, ...params: any[]) => {
|
||||
* @param params - Additional arguments to supply to the console.error.
|
||||
*/
|
||||
export const printIonError = (message: string, ...params: any[]) => {
|
||||
console.log('printIonError', config.get('logLevel'));
|
||||
const logLevel = config.get('logLevel', LogLevel.ERROR);
|
||||
if ([LogLevel.ERROR, LogLevel.WARN].includes(logLevel)) {
|
||||
return console.error(`[Ionic Error]: ${message}`, ...params);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { printIonWarning } from '@ionic/core';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* NavParams are an object that exists on a page and can contain data for that particular view.
|
||||
@@ -20,8 +22,8 @@
|
||||
*/
|
||||
export class NavParams {
|
||||
constructor(public data: { [key: string]: any } = {}) {
|
||||
console.warn(
|
||||
`[Ionic Warning]: NavParams has been deprecated in favor of using Angular's input API. Developers should migrate to either the @Input decorator or the Signals-based input API.`
|
||||
printIonWarning(
|
||||
`NavParams has been deprecated in favor of using Angular's input API. Developers should migrate to either the @Input decorator or the Signals-based input API.`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
AfterViewInit,
|
||||
QueryList,
|
||||
} from '@angular/core';
|
||||
import { printIonError } from '@ionic/core';
|
||||
|
||||
import { NavController } from '../../providers/nav-controller';
|
||||
|
||||
@@ -184,7 +185,7 @@ export abstract class IonTabs implements AfterViewInit, AfterContentInit, AfterC
|
||||
const selectedTab = tabs.find((t: any) => t.tab === tab);
|
||||
|
||||
if (!selectedTab) {
|
||||
console.error(`[Ionic Error]: Tab with id: "${tab}" does not exist`);
|
||||
printIonError(`Tab with id: "${tab}" does not exist`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
InjectionToken,
|
||||
ComponentRef,
|
||||
} from '@angular/core';
|
||||
import { printIonError } from '@ionic/core';
|
||||
import {
|
||||
FrameworkDelegate,
|
||||
LIFECYCLE_DID_ENTER,
|
||||
@@ -164,8 +165,8 @@ export const attachView = (
|
||||
* which will cause collisions.
|
||||
*/
|
||||
if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
|
||||
console.error(
|
||||
`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${
|
||||
printIonError(
|
||||
`${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${
|
||||
component.name
|
||||
}.`
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CommonModule, DOCUMENT } from '@angular/common';
|
||||
import { ModuleWithProviders, APP_INITIALIZER, NgModule, NgZone } from '@angular/core';
|
||||
import { ConfigToken, AngularDelegate, provideComponentInputBinding } from '@ionic/angular/common';
|
||||
import { IonicConfig } from '@ionic/core';
|
||||
import { initialize, IonicConfig, setupConfig } from '@ionic/core';
|
||||
|
||||
import { appInitialize } from './app-initialize';
|
||||
import {
|
||||
@@ -64,6 +64,9 @@ type OptInAngularFeatures = {
|
||||
})
|
||||
export class IonicModule {
|
||||
static forRoot(config: IonicConfig & OptInAngularFeatures = {}): ModuleWithProviders<IonicModule> {
|
||||
setupConfig(config);
|
||||
initialize(config);
|
||||
|
||||
return {
|
||||
ngModule: IonicModule,
|
||||
providers: [
|
||||
|
||||
@@ -2,7 +2,7 @@ import { DOCUMENT } from '@angular/common';
|
||||
import { APP_INITIALIZER, makeEnvironmentProviders } from '@angular/core';
|
||||
import type { EnvironmentProviders } from '@angular/core';
|
||||
import { AngularDelegate, ConfigToken, provideComponentInputBinding } from '@ionic/angular/common';
|
||||
import { initialize } from '@ionic/core/components';
|
||||
import { initialize, setupConfig } from '@ionic/core/components';
|
||||
import type { IonicConfig } from '@ionic/core/components';
|
||||
|
||||
import { ModalController } from './modal-controller';
|
||||
@@ -13,6 +13,8 @@ type OptInAngularFeatures = {
|
||||
};
|
||||
|
||||
export const provideIonicAngular = (config: IonicConfig & OptInAngularFeatures = {}): EnvironmentProviders => {
|
||||
setupConfig(config);
|
||||
|
||||
return makeEnvironmentProviders([
|
||||
{
|
||||
provide: ConfigToken,
|
||||
|
||||
Reference in New Issue
Block a user