mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added react-native-datawedge-intents (#43516)
* [react-native-datawedge-intents] Initial commit * Fix lint errors * Apply suggestions from @uniqueiniquity
This commit is contained in:
parent
6b97870ab9
commit
bf28fce907
21
types/react-native-datawedge-intents/index.d.ts
vendored
Normal file
21
types/react-native-datawedge-intents/index.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Type definitions for react-native-datawedge-intents 0.1
|
||||
// Project: https://github.com/darryncampbell/react-native-datawedge-intents#readme
|
||||
// Definitions by: DerZersaeger <https://github.com/DerZersaeger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface ExtrasObject {
|
||||
action: string;
|
||||
extras?: object;
|
||||
}
|
||||
|
||||
interface FilterObject {
|
||||
filterActions: ReadonlyArray<string>;
|
||||
filterCategories: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
declare const DataWedgeIntents: {
|
||||
sendBroadcastWithExtras: (extrasObject: ExtrasObject) => void;
|
||||
registerBroadcastReceiver: (filter: FilterObject) => void;
|
||||
};
|
||||
|
||||
export = DataWedgeIntents;
|
||||
@ -0,0 +1,26 @@
|
||||
import DataWedgeIntents from 'react-native-datawedge-intents';
|
||||
|
||||
// Register a receiver for the barcode scans with the appropriate action
|
||||
DataWedgeIntents.registerBroadcastReceiver({
|
||||
filterActions: [
|
||||
'com.zebra.reactnativedemo.ACTION',
|
||||
'com.symbol.datawedge.api.RESULT_ACTION'
|
||||
],
|
||||
filterCategories: [
|
||||
'android.intent.category.DEFAULT'
|
||||
]
|
||||
});
|
||||
|
||||
// Initiate a scan (you could also press the trigger key)
|
||||
sendCommand('com.symbol.datawedge.api.SOFT_SCAN_TRIGGER', 'TOGGLE_SCANNING');
|
||||
|
||||
function sendCommand(extraName: string, extraValue: any) {
|
||||
const broadcastExtras = {
|
||||
[extraName]: extraValue,
|
||||
SEND_RESULT: "false" // need to be passed as string
|
||||
};
|
||||
DataWedgeIntents.sendBroadcastWithExtras({
|
||||
action: "com.symbol.datawedge.api.ACTION",
|
||||
extras: broadcastExtras
|
||||
});
|
||||
}
|
||||
24
types/react-native-datawedge-intents/tsconfig.json
Normal file
24
types/react-native-datawedge-intents/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-datawedge-intents-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/react-native-datawedge-intents/tslint.json
Normal file
1
types/react-native-datawedge-intents/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user