native.removeListener(ON_RELEASED_MEDIA_KEY_EVENT_CALLBACK);
};
-exports = new MediaKeyManager();
+// conditional API export
+var relatedFeature = 'http://tizen.org/feature/network.bluetooth.audio.media';
+exports = xwalk.utils.exportModuleIfFeatureSupported(
+ relatedFeature,
+ new MediaKeyManager(),
+ undefined
+);
Object.defineProperties(WebAPIException, error_constants);
Object.defineProperties(WebAPIException.prototype, error_constants);
+// Modules should be 'undefined' if related feature is not supported.
+// Below function could be used for conditional definition of JS API exports as in below:
+// var relatedFeature = 'http://tizen.org/feature/network.bluetooth.audio.media';
+// xwalk.utils.exportModuleIfFeatureSupported(relatedFeature, exports,
+// new MediaKeyManager(), undefined);
+function exportModuleIfFeatureSupported(relatedFeature, successExport, failureExport) {
+ try {
+ if (true === tizen.systeminfo.getCapability(relatedFeature)) {
+ return successExport;
+ }
+ } catch (e) {
+ // ignore errors
+ }
+ return failureExport;
+}
+
// Export WebAPIException and WebAPIError into global scope.
// For compliance reasons their constructors should not be exported in tizen namespace,
// but should be available internally to allow throwing exceptions from modules.
Utils.prototype.validator = _validator;
Utils.prototype.NativeManager = NativeManager;
Utils.prototype.CommonListenerManager = CommonListenerManager;
+Utils.prototype.exportModuleIfFeatureSupported = exportModuleIfFeatureSupported;
var native_ = new NativeManager(extension);