@extscreen/es-core 1.1.22 → 1.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +67 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3157,6 +3157,13 @@ const ES_NETWORK_INFO_TYPE_ETHERNET = 9;
3157
3157
 
3158
3158
  var ESApplication = {
3159
3159
  mixins: [ESRouter],
3160
+ data() {
3161
+ return {
3162
+ appInitProps: {},
3163
+ appInitUrl: '',
3164
+ appInitParams: {},
3165
+ };
3166
+ },
3160
3167
  mounted() {
3161
3168
  this._initES();
3162
3169
  },
@@ -3168,46 +3175,94 @@ var ESApplication = {
3168
3175
  })
3169
3176
  )
3170
3177
  .then((result) => {
3171
- this._initESApp();
3178
+ this._initESAppParams();
3172
3179
  },
3173
3180
  error => {
3174
- this._initESApp();
3181
+ this._initESAppParams();
3175
3182
  }
3176
3183
  );
3177
3184
  },
3185
+ _initESAppParams() {
3186
+ //
3187
+ this.appInitProps = ESApp.$options.$superProps;
3188
+ //
3189
+ this.appInitUrl = ESApp.$options.$superProps.url;
3190
+ this.appInitParams = ESApp.$options.$superProps.params;
3191
+
3192
+ if (!this.appInitUrl) {
3193
+ this.appInitUrl = this.$router.options.main;
3194
+ }
3195
+ if (!(this._isRoutePathValid(this.appInitUrl) || this._isRouteNameValid(this.appInitUrl))) {
3196
+ this.appInitUrl = this.$router.options.error;
3197
+ }
3198
+ //
3199
+ this._initESApp();
3200
+ },
3178
3201
  _initESApp() {
3179
3202
  if (this._isFunction(this.onESCreate)) {
3180
- let result = this.onESCreate();
3203
+ let result = this.onESCreate(this.appInitProps);
3204
+ if (ESLog.isLoggable(ESLog.DEBUG)) {
3205
+ ESLog.d('ESApplication', '---------onESCreate---------->>>>', result);
3206
+ }
3181
3207
  if (result instanceof Promise) {
3182
3208
  result.then(
3183
- () => {
3209
+ (success) => {
3210
+ if (ESLog.isLoggable(ESLog.DEBUG)) {
3211
+ ESLog.d('ESApplication', '---------onESCreate---Promise---success---->>>>');
3212
+ }
3184
3213
  this._initPage();
3185
3214
  },
3186
3215
  error => {
3216
+ if (ESLog.isLoggable(ESLog.DEBUG)) {
3217
+ console.log('ESApplication', '---------onESCreate---Promise---error---->>>>', error);
3218
+ }
3187
3219
  this._initPage();
3188
3220
  }
3189
3221
  );
3190
3222
  } else {
3223
+ if (ESLog.isLoggable(ESLog.DEBUG)) {
3224
+ ESLog.d('ESApplication', '---------onESCreate--return-Not Promise----->>>>');
3225
+ }
3191
3226
  this._initPage();
3192
3227
  }
3193
3228
  } else {
3229
+ if (ESLog.isLoggable(ESLog.DEBUG)) {
3230
+ ESLog.d('ESApplication', '---------onESCreate---Not Function----->>>>');
3231
+ }
3194
3232
  this._initPage();
3195
3233
  }
3196
3234
  },
3197
3235
  _initPage() {
3198
- let initUrl = ESApp.$options.$superProps.url;
3199
- let initParams = ESApp.$options.$superProps.params;
3200
- if (!initUrl) {
3201
- initParams = this.$router.options.main;
3236
+ let route = {
3237
+ name: this.appInitUrl,
3238
+ params: this.appInitParams,
3239
+ };
3240
+ if (ESLog.isLoggable(ESLog.DEBUG)) {
3241
+ console.log('ESApplication', '---------onESCreate---_initPage--push--->>>>', route);
3202
3242
  }
3203
- this.$router.push({
3204
- name: initParams,
3205
- params: initParams,
3206
- });
3243
+ this.$router.push(route);
3207
3244
  },
3208
3245
  _isFunction(func) {
3209
3246
  return Object.prototype.toString.call(func) === '[object Function]';
3210
3247
  },
3248
+ _isRoutePathValid(path) {
3249
+ if (path !== undefined && path !== '') {
3250
+ let index = this.$router.options.routes.findIndex((item) => item.path === `/${path}`);
3251
+ if (index !== -1) {
3252
+ return true;
3253
+ }
3254
+ }
3255
+ return false;
3256
+ },
3257
+ _isRouteNameValid(name) {
3258
+ if (name !== undefined && name !== '') {
3259
+ let index = this.$router.options.routes.findIndex((item) => item.path === `${name}`);
3260
+ if (index !== -1) {
3261
+ return true;
3262
+ }
3263
+ }
3264
+ return false;
3265
+ },
3211
3266
  },
3212
3267
  };
3213
3268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extscreen/es-core",
3
- "version": "1.1.22",
3
+ "version": "1.1.27",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {