MCPcopy Create free account
hub / github.com/reactnativecn/react-native-update / async

Function async

Example/expoUsePushy/TestConsole.js:192–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190 }}
191 testID="submit"
192 onPress={async () => {
193 setRunning(true);
194 try {
195 const inputs = text.split('\n');
196 const methodName = inputs[0];
197 let params = [];
198 if (inputs.length === 1) {
199 if (options) {
200 await PushyModule[methodName](options);
201 } else {
202 await PushyModule[methodName]();
203 }
204 } else {
205 if (inputs.length === 2) {
206 params = [inputs[1]];
207 } else {
208 params = [inputs[1], inputs[2]];
209 console.log({inputs, params});
210 }
211 await PushyModule[methodName](...params);
212 }
213 setAlertVisible(true);
214 setAlertMsg('done');
215 } catch (e) {
216 setAlertVisible(true);
217 setAlertMsg(e.message);
218 }
219 setRunning(false);
220 }}>
221 <Text style={{color: 'white'}}>执行</Text>
222 </TouchableOpacity>
223 <Button title="重置" onPress={() => setText('')} />

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected