10,730
edits
Line 111: | Line 111: | ||
* JSBridge.js is not written as an ES module. As such, it cannot be ''import''ed or ''require''d by third-party libraries. However, if you ''include'' it as an HTML script, the global variable <code>MobileCRM</code> should be available. | * JSBridge.js is not written as an ES module. As such, it cannot be ''import''ed or ''require''d by third-party libraries. However, if you ''include'' it as an HTML script, the global variable <code>MobileCRM</code> should be available. | ||
* This may cause problems with linter or similar tools; for example, the one within the create-react-app tool. The solution is to explain the linter or (or compiler if using typescript) that the global variable <code>MobileCRM</code> exists. For example: <code>const MobileCRM = window.MobileCRM;</code> | * This may cause problems with linter or similar tools; for example, the one within the create-react-app tool. The solution is to explain the linter or (or compiler if using typescript) that the global variable <code>MobileCRM</code> exists. For example: <code>const MobileCRM = window.MobileCRM;</code> | ||
* If you are using Typescript, make sure to include the file [https://github.com/Resconet/JSBridge/blob/master/src/JSBridge.d.ts JSBridge.d.ts]. This ensures that Typescript understands the global variable <code>MobileCRM</code>. | |||
== Asynchronous approach == | == Asynchronous approach == |