@@ -93,6 +93,8 @@ To be able to use Cloud features you need to do two things:
93
93
94
94
# ### Still image (on-device)
95
95
96
+ # #### TypeScript
97
+
96
98
` ` ` typescript
97
99
import { MLKitRecognizeTextResult } from " nativescript-plugin-firebase/mlkit/textrecognition" ;
98
100
const firebase = require(" nativescript-plugin-firebase" );
@@ -104,8 +106,22 @@ firebase.mlkit.textrecognition.recognizeTextOnDevice({
104
106
}).catch(errorMessage => console.log("ML Kit error: " + errorMessage)) ;
105
107
` ` `
106
108
109
+ # #### JavaScript
110
+
111
+ ` ` ` js
112
+ var firebase = require(" nativescript-plugin-firebase" );
113
+
114
+ firebase.mlkit.textrecognition.recognizeTextOnDevice({
115
+ image: imageSource // a NativeScript Image or ImageSource, see the demo for examples
116
+ }).then(function(result) {
117
+ console.log(result.text ? result.text : " " );
118
+ }).catch(function (errorMessage) { return console.log(" ML Kit error: " + errorMessage); });
119
+ ` ` `
120
+
107
121
# ### Still image (cloud)
108
122
123
+ # #### TypeScript
124
+
109
125
` ` ` typescript
110
126
import { MLKitRecognizeTextResult } from " nativescript-plugin-firebase/mlkit/textrecognition" ;
111
127
const firebase = require(" nativescript-plugin-firebase" );
@@ -117,6 +133,18 @@ firebase.mlkit.textrecognition.recognizeTextCloud({
117
133
.catch(errorMessage => console.log(" ML Kit error: " + errorMessage));
118
134
` ` `
119
135
136
+ # #### JavaScript
137
+
138
+ ` ` ` js
139
+ var firebase = require(" nativescript-plugin-firebase" );
140
+
141
+ firebase.mlkit.textrecognition.recognizeTextCloud({
142
+ image: imageSource // a NativeScript Image or ImageSource, see the demo for examples
143
+ }).then(function(result) {
144
+ console.log(result.text ? result.text : " " );
145
+ }).catch(function (errorMessage) { return console.log(" ML Kit error: " + errorMessage); });
146
+ ` ` `
147
+
120
148
# ### Live camera feed
121
149
The exact details of using the live camera view depend on whether or not you' re using Angular / Vue.
122
150
@@ -176,7 +204,7 @@ Declare a namespace at the top of the embedding page, and use it anywhere on the
176
204
< /Page>
177
205
` ` `
178
206
179
- > Note that with NativeScript 4 the ` Page` tag may actually be a ` TabView` , but adding the namespace declaration to the TabView works just as well.
207
+ > Note that since NativeScript 4 the ` Page` tag may actually be a ` TabView` , but adding the namespace declaration to the TabView works just as well.
180
208
181
209
# ## Face detection
182
210
< img src=" https://raw.githubusercontent.com/EddyVerbruggen/nativescript-plugin-firebase/master/docs/images/features/mlkit_face_detection.png" height=" 153px" alt=" ML Kit - Face detection" />
0 commit comments