Girish Fuluskar
Girish Fuluskar

Reputation: 21

t.resolve is not a function in ionic 4

My use case:

Call JavaScript function from JS file (included in project) in Ionic 4 on particular page.

I'm having following issue.

ERROR TypeError: t.resolve is not a function
at Object.setNativePromise (polyfills.js:3)
at L.configurable.L.set (polyfills.js:3)
at n.exports (ocw.js:4850)
at a (ocw.js:4850)
at Object.209.100 (ocw.js:4851)
at s (ocw.js:4850)
at ocw.js:4850
at Object.327.131 (ocw.js:4852)
at s (ocw.js:4850)
at ocw.js:4850

Steps followed:

  1. Included JS file under src->assets
  2. added reference in index.html after cordova.js file

<!-- cordova.js required for cordova apps (remove if not needed) -->
  <!-- <script src="assets/ocw.js"></script> -->
  <script src="cordova.js"></script>
  
  <script src="assets/ocw.js"></script>

  1. In desired file, declared variable as function name
  2. called javascript function under, ionViewDidLoad

Ionic setup:

Ionic:

ionic (Ionic CLI) : 4.1.2 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.0.0 Cordova Platforms : android 6.4.0, ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.2, (and 9 other plugins)

System:

ios-deploy : 1.9.2 ios-sim : 6.0.0 NodeJS : v8.12.0 (/usr/local/bin/node) npm : 6.4.1 OS : macOS Xcode : Xcode 10.1 Build version 10B61

Upvotes: 1

Views: 1032

Answers (1)

alex87
alex87

Reputation: 472

You need to export the function in your javascript file and then import it in your pagename.page.ts to be able to use it.

Upvotes: -1

Related Questions