mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Merge pull request #26504 from NextFaze/feature/wikitude-cordova-plugin
Add wikitude-cordova-plugin types
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const startupConfiguration: any = { camera_position: 'back' };
|
||||
|
||||
// Some code samples from the wikitude ionic starter
|
||||
WikitudePlugin.loadARchitectWorld(
|
||||
success => {
|
||||
console.log('ARchitect World loaded successfully.');
|
||||
},
|
||||
fail => {
|
||||
console.log('Failed to load ARchitect World!');
|
||||
},
|
||||
'www/assets/07_3dModels_6_3dModelAtGeoLocation/index.html',
|
||||
['geo'],
|
||||
<JSON> startupConfiguration
|
||||
);
|
||||
|
||||
WikitudePlugin.setOnUrlInvokeCallback(url => {
|
||||
if (url.indexOf('captureScreen') > -1) {
|
||||
WikitudePlugin.captureScreen(
|
||||
absoluteFilePath => {
|
||||
WikitudePlugin.callJavaScript(
|
||||
`World.testFunction('Screenshot saved at: ${absoluteFilePath}');`
|
||||
);
|
||||
},
|
||||
errorMessage => {
|
||||
console.log(errorMessage);
|
||||
},
|
||||
true,
|
||||
null
|
||||
);
|
||||
} else {
|
||||
alert(url + 'not handled');
|
||||
}
|
||||
});
|
||||
82
types/com.wikitude.phonegap.wikitudeplugin/index.d.ts
vendored
Normal file
82
types/com.wikitude.phonegap.wikitudeplugin/index.d.ts
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Type definitions for com.wikitude.phonegap.wikitudeplugin 7.2
|
||||
// Project: https://github.com/Wikitude/wikitude-cordova-plugin
|
||||
// Definitions by: zbarbuto <https://github.com/zbarbuto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
// The following types are taken directly (unmodified) from the wikitude-ionic-3-starter-app
|
||||
// https://github.com/pbreuss/wikitude-ionic-3-starter-app
|
||||
// Latest commit at time of writing was 647cd546f6d1805765c4cee725566e246ca6259d
|
||||
|
||||
/**
|
||||
* Wrapper for the Wikitude SDK Phonegap Plugin - to use with IONIC2
|
||||
* (c) 2016 Schneeweis.Technology
|
||||
*/
|
||||
interface WikitudePlugin {
|
||||
isDeviceSupported(
|
||||
successCallback: (success: string) => void,
|
||||
errorCallback: (message: string) => void,
|
||||
requiredFeatures: [string]
|
||||
): void;
|
||||
|
||||
loadARchitectWorld(
|
||||
successCallback: (success: string) => void,
|
||||
errorCallback: (message: string) => void,
|
||||
architectWorldPath: string,
|
||||
requiredFeatures: [string],
|
||||
startupConfiguration: JSON | object
|
||||
): void;
|
||||
|
||||
close(): void;
|
||||
|
||||
hide(): void;
|
||||
|
||||
show(): void;
|
||||
|
||||
// test type ok?
|
||||
callJavaScript(js: any): void;
|
||||
|
||||
setOnUrlInvokeCallback(onUrlInvokeCallback: (success: string) => void): void;
|
||||
|
||||
setLocation(latitude: any, longitude: any, altitude: any, accuracy: any): void;
|
||||
|
||||
captureScreen(
|
||||
successCallback: (success: string) => void,
|
||||
errorCallback: (message: string) => void,
|
||||
includeWebView: boolean,
|
||||
imagePathInBundleOrNullForPhotoLibrary: string | null
|
||||
): void;
|
||||
|
||||
setErrorHandler(errorHandler: (message: string) => void): void;
|
||||
|
||||
setDeviceSensorsNeedCalibrationHandler(
|
||||
startCalibrationHandler: (message: string) => void
|
||||
): void;
|
||||
|
||||
setDeviceSensorsFinishedCalibrationHandler(
|
||||
finishedCalibrationHandler: (message: string) => void
|
||||
): void;
|
||||
|
||||
setBackButtonCallback(onBackButtonCallback: (message: string) => void): void;
|
||||
|
||||
/* Lifecycle updates */
|
||||
|
||||
onResume(): void;
|
||||
onBackButton(): void;
|
||||
onPause(): void;
|
||||
|
||||
onWikitudeOK(): void;
|
||||
onWikitudeError(): void;
|
||||
|
||||
_sdkKey: string;
|
||||
FeatureGeo: string;
|
||||
Feature2DTracking: string;
|
||||
CameraPositionUndefined: number;
|
||||
CameraPositionFront: number;
|
||||
CameraPositionBack: number;
|
||||
CameraFocusRangeNone: number;
|
||||
CameraFocusRangeNear: number;
|
||||
CameraFocusRangeFar: number;
|
||||
}
|
||||
|
||||
declare var WikitudePlugin: WikitudePlugin;
|
||||
24
types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json
Normal file
24
types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"com.wikitude.phonegap.wikitudeplugin-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/com.wikitude.phonegap.wikitudeplugin/tslint.json
Normal file
3
types/com.wikitude.phonegap.wikitudeplugin/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user