You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2013/07/04 16:49:31 UTC
[1/2] js commit: [CB-3720] [BlackBerry10] Remove File overrides
(moving to plugin)
Updated Branches:
refs/heads/master 0e89b601a -> 08a2641cf
[CB-3720] [BlackBerry10] Remove File overrides (moving to plugin)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5409661d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5409661d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5409661d
Branch: refs/heads/master
Commit: 5409661db6ff9691b9e7a7c6d47b51e5b07cf828
Parents: 0e89b60
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Fri Jun 28 14:37:45 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Thu Jul 4 10:26:39 2013 -0400
----------------------------------------------------------------------
lib/blackberry10/plugin/DirectoryEntry.js | 57 ---------
lib/blackberry10/plugin/DirectoryReader.js | 47 --------
lib/blackberry10/plugin/Entry.js | 112 -----------------
lib/blackberry10/plugin/FileEntry.js | 47 --------
lib/blackberry10/plugin/FileReader.js | 90 --------------
lib/blackberry10/plugin/FileSystem.js | 27 -----
lib/blackberry10/plugin/FileWriter.js | 120 -------------------
lib/blackberry10/plugin/requestFileSystem.js | 38 ------
.../plugin/resolveLocalFileSystemURI.js | 55 ---------
9 files changed, 593 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/DirectoryEntry.js b/lib/blackberry10/plugin/DirectoryEntry.js
deleted file mode 100644
index 259a79e..0000000
--- a/lib/blackberry10/plugin/DirectoryEntry.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- utils = require('cordova/utils'),
- Entry = require('cordova/plugin/Entry'),
- FileError = require('cordova/plugin/FileError'),
- DirectoryReader = require('cordova/plugin/DirectoryReader'),
- fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
- DirectoryEntry = function (name, fullPath) {
- DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath);
- };
-
-utils.extend(DirectoryEntry, Entry);
-
-DirectoryEntry.prototype.createReader = function () {
- return new DirectoryReader(this.fullPath);
-};
-
-DirectoryEntry.prototype.getDirectory = function (path, options, successCallback, errorCallback) {
- argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
- this.nativeEntry.getDirectory(path, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
-};
-
-DirectoryEntry.prototype.removeRecursively = function (successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'DirectoryEntry.removeRecursively', arguments);
- this.nativeEntry.removeRecursively(successCallback, errorCallback);
-};
-
-DirectoryEntry.prototype.getFile = function (path, options, successCallback, errorCallback) {
- argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
- this.nativeEntry.getFile(path, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
-};
-
-module.exports = DirectoryEntry;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/DirectoryReader.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/DirectoryReader.js b/lib/blackberry10/plugin/DirectoryReader.js
deleted file mode 100644
index 8bb9968..0000000
--- a/lib/blackberry10/plugin/DirectoryReader.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var FileError = require('cordova/plugin/FileError'),
- fileUtils = require('cordova/plugin/blackberry10/fileUtils');
-
-function DirectoryReader(path) {
- this.path = path;
-}
-
-DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(result) {
- var retVal = [];
- for (var i=0; i<result.length; i++) {
- retVal.push(fileUtils.createEntry(result[i]));
- }
- successCallback(retVal);
- },
- fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
- fileUtils.getEntryForURI(this.path, function (entry) {
- entry.nativeEntry.createReader().readEntries(win, fail);
- }, function () {
- fail(FileError.NOT_FOUND_ERR);
- });
-};
-
-module.exports = DirectoryReader;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/Entry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/Entry.js b/lib/blackberry10/plugin/Entry.js
deleted file mode 100644
index cf971fe..0000000
--- a/lib/blackberry10/plugin/Entry.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- FileError = require('cordova/plugin/FileError'),
- Metadata = require('cordova/plugin/Metadata'),
- fileUtils = require('cordova/plugin/blackberry10/fileUtils');
-
-function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
- this.isFile = !!isFile;
- this.isDirectory = !!isDirectory;
- this.name = name || '';
- this.fullPath = fullPath || '';
- this.filesystem = fileSystem || null;
-}
-
-Entry.prototype.getMetadata = function(successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'Entry.getMetadata', arguments);
- var success = function(lastModified) {
- var metadata = new Metadata(lastModified);
- if (typeof successCallback === 'function') {
- successCallback(metadata);
- }
- };
- this.nativeEntry.getMetadata(success, errorCallback);
-};
-
-Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) {
- argscheck.checkArgs('FFO', 'Entry.setMetadata', arguments);
- errorCallback("Not supported by platform");
-};
-
-Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
- argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
- var srcPath = this.fullPath,
- name = newName || this.name,
- success = function(entry) {
- if (entry) {
- if (typeof successCallback === 'function') {
- successCallback(fileUtils.createEntry(entry));
- }
- }
- else {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
- }
- };
- this.nativeEntry.moveTo(parent.nativeEntry, newName, success, errorCallback);
-};
-
-
-Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
- argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
- var srcPath = this.fullPath,
- name = newName || this.name,
- success = function(entry) {
- if (entry) {
- if (typeof successCallback === 'function') {
- successCallback(fileUtils.createEntry(entry));
- }
- }
- else {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
- }
- };
- this.nativeEntry.copyTo(parent.nativeEntry, newName, success, errorCallback);
-};
-
-Entry.prototype.toURL = function() {
- return this.fullPath;
-};
-
-Entry.prototype.toURI = function(mimeType) {
- console.log("DEPRECATED: Update your code to use 'toURL'");
- return this.toURL();
-};
-
-Entry.prototype.remove = function(successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'Entry.remove', arguments);
- this.nativeEntry.remove(successCallback, errorCallback);
-};
-
-Entry.prototype.getParent = function(successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'Entry.getParent', arguments);
- var win = successCallback && function(result) {
- successCallback(fileUtils.createEntry(result));
- };
- this.nativeEntry.getParent(win, errorCallback);
-};
-
-module.exports = Entry;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/FileEntry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/FileEntry.js b/lib/blackberry10/plugin/FileEntry.js
deleted file mode 100644
index 17f9393..0000000
--- a/lib/blackberry10/plugin/FileEntry.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var utils = require('cordova/utils'),
- Entry = require('cordova/plugin/Entry'),
- FileWriter = require('cordova/plugin/FileWriter'),
- File = require('cordova/plugin/File'),
- FileError = require('cordova/plugin/FileError'),
- FileEntry = function (name, fullPath) {
- FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath]);
- };
-
-utils.extend(FileEntry, Entry);
-
-FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
- this.file(function (file) {
- successCallback(new FileWriter(file));
- }, errorCallback);
-};
-
-FileEntry.prototype.file = function(successCallback, errorCallback) {
- var fullPath = this.fullPath,
- success = function (file) {
- successCallback(new File(file.name, fullPath, file.type, file.lastModifiedDate, file.size));
- };
- this.nativeEntry.file(success, errorCallback);
-};
-
-module.exports = FileEntry;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/FileReader.js b/lib/blackberry10/plugin/FileReader.js
deleted file mode 100644
index 17214ef..0000000
--- a/lib/blackberry10/plugin/FileReader.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var origFileReader = window.FileReader,
- fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
- utils = require('cordova/utils');
-
-var FileReader = function() {
- this.nativeReader = new origFileReader();
-};
-
-utils.defineGetter(FileReader.prototype, 'readyState', function() {
- return this.nativeReader.readyState;
-});
-
-utils.defineGetter(FileReader.prototype, 'error', function() {
- return this.nativeReader.error;
-});
-
-utils.defineGetter(FileReader.prototype, 'result', function() {
- return this.nativeReader.result;
-});
-
-function defineEvent(eventName) {
- utils.defineGetterSetter(FileReader.prototype, eventName, function() {
- return this.nativeReader[eventName] || null;
- }, function(value) {
- this.nativeReader[eventName] = value;
- });
-}
-
-defineEvent('onabort');
-defineEvent('onerror');
-defineEvent('onload');
-defineEvent('onloadend');
-defineEvent('onloadstart');
-defineEvent('onprogress');
-
-FileReader.prototype.abort = function() {
- return this.nativeReader.abort();
-};
-
-function read(method, context, file, encoding) {
- if (file.fullPath) {
- fileUtils.getEntryForURI(file.fullPath, function (entry) {
- entry.nativeEntry.file(function (nativeFile) {
- context.nativeReader[method].call(context.nativeReader, nativeFile, encoding);
- }, context.onerror);
- }, context.onerror);
- } else {
- context.nativeReader[method](file, encoding);
- }
-}
-
-FileReader.prototype.readAsText = function(file, encoding) {
- read("readAsText", this, file, encoding);
-};
-
-FileReader.prototype.readAsDataURL = function(file) {
- read("readAsDataURL", this, file);
-};
-
-FileReader.prototype.readAsBinaryString = function(file) {
- read("readAsBinaryString", this, file);
-};
-
-FileReader.prototype.readAsArrayBuffer = function(file) {
- read("readAsArrayBuffer", this, file);
-};
-
-window.FileReader = FileReader;
-module.exports = FileReader;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/FileSystem.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/FileSystem.js b/lib/blackberry10/plugin/FileSystem.js
deleted file mode 100644
index d1432d6..0000000
--- a/lib/blackberry10/plugin/FileSystem.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-module.exports = function(name, root) {
- this.name = name || null;
- if (root) {
- this.root = root;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/FileWriter.js b/lib/blackberry10/plugin/FileWriter.js
deleted file mode 100644
index 0f71d6a..0000000
--- a/lib/blackberry10/plugin/FileWriter.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var FileError = require('cordova/plugin/FileError'),
- ProgressEvent = require('cordova/plugin/ProgressEvent'),
- fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
- utils = require('cordova/utils');
-
-function FileWriter (file) {
- var that = this;
- this.file = file;
- this.events = {};
- this.pending = [];
- fileUtils.getEntryForURI(file.fullPath, function (entry) {
- entry.nativeEntry.createWriter(function (writer) {
- var i,
- event;
- that.nativeWriter = writer;
- for (event in that.events) {
- if (that.events.hasOwnProperty(event)) {
- that.nativeWriter[event] = that.events[event];
- }
- }
- for (i = 0; i < that.pending.length; i++) {
- that.pending[i]();
- }
- });
- });
- this.events = {};
- this.pending = [];
-}
-
-utils.defineGetter(FileWriter.prototype, 'error', function() {
- return this.nativeWriter ? this.nativeWriter.error : null;
-});
-
-utils.defineGetter(FileWriter.prototype, 'fileName', function() {
- return this.nativeWriter ? this.nativeWriter.fileName : this.file.name;
-});
-
-utils.defineGetter(FileWriter.prototype, 'length', function() {
- return this.nativeWriter ? this.nativeWriter.length : this.file.size;
-});
-
-utils.defineGetter(FileWriter.prototype, 'position', function() {
- return this.nativeWriter ? this.nativeWriter.position : 0;
-});
-
-utils.defineGetter(FileWriter.prototype, 'readyState', function() {
- return this.nativeWriter ? this.nativeWriter.readyState : 0;
-});
-
-function defineEvent(eventName) {
- utils.defineGetterSetter(FileWriter.prototype, eventName, function() {
- return this.nativeWriter ? this.nativeWriter[eventName] || null : this.events[eventName] || null;
- }, function(value) {
- if (this.nativeWriter) {
- this.nativeWriter[eventName] = value;
- }
- else {
- this.events[eventName] = value;
- }
- });
-}
-
-defineEvent('onabort');
-defineEvent('onerror');
-defineEvent('onprogress');
-defineEvent('onwrite');
-defineEvent('onwriteend');
-defineEvent('onwritestart');
-
-FileWriter.prototype.abort = function() {
- this.nativeWriter.abort();
-};
-
-FileWriter.prototype.write = function(text) {
- var that = this,
- op = function () {
- that.nativeWriter.write(new Blob([text]));
- };
- this.nativeWriter ? op() : this.pending.push(op);
-
-};
-
-FileWriter.prototype.seek = function(offset) {
- var that = this,
- op = function () {
- that.nativeWriter.seek(offset);
- };
- this.nativeWriter ? op() : this.pending.push(op);
-};
-
-FileWriter.prototype.truncate = function(size) {
- var that = this,
- op = function () {
- that.nativeWriter.truncate(size);
- };
- this.nativeWriter ? op() : this.pending.push(op);
-};
-
-module.exports = FileWriter;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/requestFileSystem.js b/lib/blackberry10/plugin/requestFileSystem.js
deleted file mode 100644
index 62e1753..0000000
--- a/lib/blackberry10/plugin/requestFileSystem.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
- FileError = require('cordova/plugin/FileError'),
- FileSystem = require('cordova/plugin/FileSystem');
-
-module.exports = function (type, size, success, fail) {
- if (size >= 1000000000000000) {
- fail(new FileError(FileError.QUOTA_EXCEEDED_ERR));
- } else if (type !== 1 && type !== 0) {
- fail(new FileError(FileError.SYNTAX_ERR));
- } else {
- window.webkitRequestFileSystem(type, size, function (fs) {
- success((new FileSystem(fileUtils.getFileSystemName(fs), fileUtils.createEntry(fs.root))));
- }, function (error) {
- fail(new FileError(error));
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5409661d/lib/blackberry10/plugin/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/resolveLocalFileSystemURI.js b/lib/blackberry10/plugin/resolveLocalFileSystemURI.js
deleted file mode 100644
index d11b0ca..0000000
--- a/lib/blackberry10/plugin/resolveLocalFileSystemURI.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
- FileError = require('cordova/plugin/FileError');
-
-module.exports = function (uri, success, fail) {
- var type,
- path,
- paramPath;
- if (!uri || uri.indexOf("/") === 0) {
- fail(new FileError(FileError.ENCODING_ERR));
- } else {
- type = uri.indexOf("persistent") === -1 ? 0 : 1;
- path = uri.substring(type === 1 ? uri.indexOf("persistent") + 11 : uri.indexOf("temporary") + 10);
- if (path.substring(0,1) == "/") {
- path = path.substring(1);
- }
- paramPath = path.indexOf("?");
- if (paramPath > -1) {
- path = path.substring(0, paramPath);
- }
- window.webkitRequestFileSystem(type, 25*1024*1024, function (fs) {
- if (path === "") {
- success(fileUtils.createEntry(fs.root));
- } else {
- fs.root.getDirectory(path, {}, function (entry) {
- success(fileUtils.createEntry(entry));
- }, function () {
- fs.root.getFile(path, {}, function (entry) {
- success(fileUtils.createEntry(entry));
- }, fail);
- });
- }
- }, fail);
- }
-};
[2/2] js commit: [CB-3193] [BlackBerry10] Remove all plugins from
cordova-js
Posted by bh...@apache.org.
[CB-3193] [BlackBerry10] Remove all plugins from cordova-js
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/08a2641c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/08a2641c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/08a2641c
Branch: refs/heads/master
Commit: 08a2641cf76797797208159d6a2c2f3ca714a3bb
Parents: 5409661
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Fri Jun 28 15:06:57 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Thu Jul 4 10:27:40 2013 -0400
----------------------------------------------------------------------
.gitignore | 1 +
lib/blackberry10/exec.js | 27 +-
lib/blackberry10/platform.js | 7 +-
lib/blackberry10/plugin/.gitkeep | 0
lib/blackberry10/plugin/FileTransfer.js | 187 -------
.../plugin/blackberry10/InAppBrowser.js | 86 ---
lib/blackberry10/plugin/blackberry10/compass.js | 162 ------
lib/blackberry10/plugin/blackberry10/event.js | 102 ----
.../plugin/blackberry10/exception.js | 74 ---
.../plugin/blackberry10/fileTransfer.js | 201 -------
.../plugin/blackberry10/fileUtils.js | 47 --
.../plugin/blackberry10/magnetometer.js | 45 --
lib/blackberry10/plugin/blackberry10/media.js | 189 -------
lib/blackberry10/plugin/blackberry10/utils.js | 556 -------------------
lib/blackberry10/plugin/blackberry10/vibrate.js | 31 --
lib/scripts/bootstrap-blackberry10.js | 7 +-
test/blackberry10/test.compass.js | 61 --
test/blackberry10/test.event.js | 188 -------
test/blackberry10/test.magnetometer.js | 80 ---
19 files changed, 6 insertions(+), 2045 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7522d0d..2291753 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ pkg/
tags
.DS_Store
node_modules/
+.gitkeep
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/exec.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/exec.js b/lib/blackberry10/exec.js
index dda4d4a..f0ffd6f 100644
--- a/lib/blackberry10/exec.js
+++ b/lib/blackberry10/exec.js
@@ -19,29 +19,4 @@
*
*/
-var cordova = require('cordova'),
- plugins = {
- 'Compass' : require('cordova/plugin/blackberry10/magnetometer'),
- 'FileTransfer': require('cordova/plugin/blackberry10/fileTransfer')
- };
-
-/**
- * Execute a cordova command. It is up to the native side whether this action
- * is synchronous or asynchronous. The native side can return:
- * Synchronous: PluginResult object as a JSON string
- * Asynchronous: Empty string ""
- * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
- * depending upon the result of the action.
- *
- * @param {Function} success The success callback
- * @param {Function} fail The fail callback
- * @param {String} service The name of the service to use
- * @param {String} action Action to be run in cordova
- * @param {String[]} [args] Zero or more arguments to pass to the method
- */
-module.exports = function (success, fail, service, action, args) {
- if (plugins[service] && plugins[service][action]) {
- return plugins[service][action](args, success, fail);
- }
- return webworks.exec(success, fail, service, action, args);
-};
+module.exports = webworks.exec;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/platform.js b/lib/blackberry10/platform.js
index 0b15ca1..007c06e 100644
--- a/lib/blackberry10/platform.js
+++ b/lib/blackberry10/platform.js
@@ -28,11 +28,6 @@ module.exports = {
modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
modulemapper.loadMatchingModules(new RegExp('cordova/blackberry10/.*bbsymbols$'));
-
- modulemapper.clobbers('cordova/plugin/blackberry10/vibrate', 'navigator.notification.vibrate');
- modulemapper.clobbers('cordova/plugin/File', 'File');
- modulemapper.merges('cordova/plugin/blackberry10/compass', 'navigator.compass');
-
modulemapper.mapModules(window);
//override to pass online/offline events to window
@@ -42,6 +37,6 @@ module.exports = {
} else {
addDocumentEventListener.apply(document, arguments);
}
- }
+ };
}
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/.gitkeep
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/.gitkeep b/lib/blackberry10/plugin/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/FileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/FileTransfer.js b/lib/blackberry10/plugin/FileTransfer.js
deleted file mode 100644
index 09b9d5f..0000000
--- a/lib/blackberry10/plugin/FileTransfer.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- exec = require('cordova/exec'),
- FileTransferError = require('cordova/plugin/FileTransferError');
-
-function getBasicAuthHeader(urlString) {
- var header = null;
-
- if (window.btoa) {
- // parse the url using the Location object
- var url = document.createElement('a');
- url.href = urlString;
-
- var credentials = null;
- var protocol = url.protocol + "//";
- var origin = protocol + url.host;
-
- // check whether there are the username:password credentials in the url
- if (url.href.indexOf(origin) !== 0) { // credentials found
- var atIndex = url.href.indexOf("@");
- credentials = url.href.substring(protocol.length, atIndex);
- }
-
- if (credentials) {
- var authHeader = "Authorization";
- var authHeaderValue = "Basic " + window.btoa(credentials);
-
- header = {
- name : authHeader,
- value : authHeaderValue
- };
- }
- }
-
- return header;
-}
-
-var idCounter = 0;
-
-/**
- * FileTransfer uploads a file to a remote server.
- * @constructor
- */
-var FileTransfer = function() {
- this._id = ++idCounter;
- this.onprogress = null; // optional callback
-};
-
-/**
-* Given an absolute file path, uploads a file on the device to a remote server
-* using a multipart HTTP request.
-* @param filePath {String} Full path of the file on the device
-* @param server {String} URL of the server to receive the file
-* @param successCallback (Function} Callback to be invoked when upload has completed
-* @param errorCallback {Function} Callback to be invoked upon error
-* @param options {FileUploadOptions} Optional parameters such as file name and mimetype
-* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
-*/
-FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) {
- argscheck.checkArgs('ssFFO*', 'FileTransfer.upload', arguments);
- // check for options
- var fileKey = null;
- var fileName = null;
- var mimeType = null;
- var params = null;
- var chunkedMode = true;
- var headers = null;
- var httpMethod = null;
- var basicAuthHeader = getBasicAuthHeader(server);
- if (basicAuthHeader) {
- options = options || {};
- options.headers = options.headers || {};
- options.headers[basicAuthHeader.name] = basicAuthHeader.value;
- }
-
- if (options) {
- fileKey = options.fileKey;
- fileName = options.fileName;
- mimeType = options.mimeType;
- headers = options.headers;
- httpMethod = options.httpMethod || "POST";
- if (httpMethod.toUpperCase() == "PUT"){
- httpMethod = "PUT";
- } else {
- httpMethod = "POST";
- }
- if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") {
- chunkedMode = options.chunkedMode;
- }
- if (options.params) {
- params = options.params;
- }
- else {
- params = {};
- }
- }
-
- var fail = errorCallback && function(e) {
- var error = new FileTransferError(e.code, e.source, e.target, e.http_status, e.body);
- errorCallback(error);
- };
-
- var self = this;
- var win = function(result) {
- if (typeof result.lengthComputable != "undefined") {
- if (self.onprogress) {
- self.onprogress(result);
- }
- } else {
- successCallback && successCallback(result);
- }
- };
- exec(win, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode, headers, this._id, httpMethod]);
-};
-
-/**
- * Downloads a file form a given URL and saves it to the specified directory.
- * @param source {String} URL of the server to receive the file
- * @param target {String} Full path of the file on the device
- * @param successCallback (Function} Callback to be invoked when upload has completed
- * @param errorCallback {Function} Callback to be invoked upon error
- * @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
- * @param options {FileDownloadOptions} Optional parameters such as headers
- */
-FileTransfer.prototype.download = function(source, target, successCallback, errorCallback, trustAllHosts, options) {
- argscheck.checkArgs('ssFF*', 'FileTransfer.download', arguments);
- var self = this;
-
- var basicAuthHeader = getBasicAuthHeader(source);
- if (basicAuthHeader) {
- options = options || {};
- options.headers = options.headers || {};
- options.headers[basicAuthHeader.name] = basicAuthHeader.value;
- }
-
- var headers = null;
- if (options) {
- headers = options.headers || null;
- }
-
- var win = function(result) {
- if (typeof result.lengthComputable != "undefined") {
- if (self.onprogress) {
- return self.onprogress(result);
- }
- } else if (successCallback) {
- successCallback(result);
- }
- };
-
- var fail = errorCallback && function(e) {
- var error = new FileTransferError(e.code, e.source, e.target, e.http_status, e.body);
- errorCallback(error);
- };
-
- exec(win, fail, 'FileTransfer', 'download', [source, target, trustAllHosts, this._id, headers]);
-};
-
-/**
- * Aborts the ongoing file transfer on this object. The original error
- * callback for the file transfer will be called if necessary.
- */
-FileTransfer.prototype.abort = function() {
- exec(null, null, 'FileTransfer', 'abort', [this._id]);
-};
-
-module.exports = FileTransfer;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/InAppBrowser.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/InAppBrowser.js b/lib/blackberry10/plugin/blackberry10/InAppBrowser.js
deleted file mode 100644
index e42a293..0000000
--- a/lib/blackberry10/plugin/blackberry10/InAppBrowser.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var cordova = require('cordova'),
- modulemapper = require('cordova/modulemapper'),
- origOpen = modulemapper.getOriginalSymbol(window, 'open'),
- browser = {
- close: function () { } //dummy so we don't have to check for undefined
- };
-
-var navigate = {
- "_blank": function (url, whitelisted) {
- return origOpen(url, "_blank");
- },
-
- "_self": function (url, whitelisted) {
- if (whitelisted) {
- window.location.href = url;
- return window;
- }
- else {
- return origOpen(url, "_blank");
- }
- },
-
- "_system": function (url, whitelisted) {
- blackberry.invoke.invoke({
- target: "sys.browser",
- uri: url
- }, function () {}, function () {});
-
- return {
- close: function () { }
- };
- }
-};
-
-module.exports = {
- open: function (args, win, fail) {
- var url = args[0],
- target = args[1] || '_self',
- a = document.createElement('a');
-
- //Make all URLs absolute
- a.href = url;
- url = a.href;
-
- switch (target) {
- case '_self':
- case '_system':
- case '_blank':
- break;
- default:
- target = '_blank';
- break;
- }
-
- webworks.exec(function (whitelisted) {
- browser = navigate[target](url, whitelisted);
- }, fail, "org.apache.cordova", "isWhitelisted", [url], true);
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "" };
- },
- close: function (args, win, fail) {
- browser.close();
- return { "status" : cordova.callbackStatus.OK, "message" : "" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/compass.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/compass.js b/lib/blackberry10/plugin/blackberry10/compass.js
deleted file mode 100644
index 061ceb5..0000000
--- a/lib/blackberry10/plugin/blackberry10/compass.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var exec = require('cordova/exec'),
- utils = require('cordova/utils'),
- CompassHeading = require('cordova/plugin/CompassHeading'),
- CompassError = require('cordova/plugin/CompassError'),
- timers = {},
- listeners = [],
- heading = null,
- running = false,
- start = function () {
- exec(function (result) {
- heading = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
- listeners.forEach(function (l) {
- l.win(heading);
- });
- }, function (e) {
- listeners.forEach(function (l) {
- l.fail(e);
- });
- },
- "Compass", "start", []);
- running = true;
- },
- stop = function () {
- exec(null, null, "Compass", "stop", []);
- running = false;
- },
- createCallbackPair = function (win, fail) {
- return {win:win, fail:fail};
- },
- removeListeners = function (l) {
- var idx = listeners.indexOf(l);
- if (idx > -1) {
- listeners.splice(idx, 1);
- if (listeners.length === 0) {
- stop();
- }
- }
- },
- compass = {
- /**
- * Asynchronously acquires the current heading.
- * @param {Function} successCallback The function to call when the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {CompassOptions} options The options for getting the heading data (not used).
- */
- getCurrentHeading:function(successCallback, errorCallback, options) {
- if (typeof successCallback !== "function") {
- throw "getCurrentHeading must be called with at least a success callback function as first parameter.";
- }
-
- var p;
- var win = function(a) {
- removeListeners(p);
- successCallback(a);
- };
- var fail = function(e) {
- removeListeners(p);
- errorCallback(e);
- };
-
- p = createCallbackPair(win, fail);
- listeners.push(p);
-
- if (!running) {
- start();
- }
- },
-
- /**
- * Asynchronously acquires the heading repeatedly at a given interval.
- * @param {Function} successCallback The function to call each time the heading
- * data is available
- * @param {Function} errorCallback The function to call when there is an error
- * getting the heading data.
- * @param {HeadingOptions} options The options for getting the heading data
- * such as timeout and the frequency of the watch. For iOS, filter parameter
- * specifies to watch via a distance filter rather than time.
- */
- watchHeading:function(successCallback, errorCallback, options) {
- var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
- var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
-
- // successCallback required
- if (typeof successCallback !== "function") {
- console.log("Compass Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback !== "function")) {
- console.log("Compass Error: errorCallback is not a function");
- return;
- }
- // Keep reference to watch id, and report heading readings as often as defined in frequency
- var id = utils.createUUID();
-
- var p = createCallbackPair(function(){}, function(e) {
- removeListeners(p);
- errorCallback(e);
- });
- listeners.push(p);
-
- timers[id] = {
- timer:window.setInterval(function() {
- if (heading) {
- successCallback(heading);
- }
- }, frequency),
- listeners:p
- };
-
- if (running) {
- // If we're already running then immediately invoke the success callback
- // but only if we have retrieved a value, sample code does not check for null ...
- if(heading) {
- successCallback(heading);
- }
- } else {
- start();
- }
-
- return id;
- },
-
- /**
- * Clears the specified heading watch.
- * @param {String} watchId The ID of the watch returned from #watchHeading.
- */
- clearWatch:function(id) {
- // Stop javascript timer & remove from timer list
- if (id && timers[id]) {
- window.clearInterval(timers[id].timer);
- removeListeners(timers[id].listeners);
- delete timers[id];
- }
- }
- };
-
-module.exports = compass;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/event.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/event.js b/lib/blackberry10/plugin/blackberry10/event.js
deleted file mode 100644
index 9e91fe4..0000000
--- a/lib/blackberry10/plugin/blackberry10/event.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var _handlers = {};
-
-function _add(featureId, name, cb, success, fail, once) {
- var handler;
- if (featureId && name && typeof cb === "function") {
- handler = {
- func: cb,
- once: !!once
- };
- //If this is the first time we are adding a cb
- if (!_handlers.hasOwnProperty(name)) {
- _handlers[name] = [handler];
- //Once listeners should not be registered with the context because there is no underlying event to call them
- //HOWEVER the webview needs to register itself with lib/event.
- if (once) {
- window.webworks.exec(success, fail, "event", "once", {"eventName": name});
- } else {
- window.webworks.exec(success, fail, featureId, "add", {"eventName": name});
- }
- } else if (!_handlers[name].some(function (element, index, array) {
- return element.func === cb;
- })) {
- //Only add unique callbacks
- _handlers[name].push(handler);
- }
- }
-}
-
-module.exports = {
- add: function (featureId, name, cb, success, fail) {
- _add(featureId, name, cb, success, fail, false);
- },
-
- once: function (featureId, name, cb, success, fail) {
- _add(featureId, name, cb, success, fail, true);
- },
-
- isOn: function (name) {
- return !!_handlers[name];
- },
-
- remove: function (featureId, name, cb, success, fail) {
- if (featureId && name && typeof cb === "function") {
- if (_handlers.hasOwnProperty(name)) {
- _handlers[name] = _handlers[name].filter(function (element, index, array) {
- return element.func !== cb || element.once;
- });
-
- if (_handlers[name].length === 0) {
- delete _handlers[name];
- window.webworks.exec(success, fail, featureId, "remove", {"eventName": name});
- }
- }
- }
- },
-
- trigger: function (name, args) {
- var parsedArgs;
- if (_handlers.hasOwnProperty(name)) {
- if (args && args !== "undefined") {
- parsedArgs = JSON.parse(decodeURIComponent(unescape(args)));
- }
- //Call the handlers
- _handlers[name].forEach(function (handler) {
- if (handler) {
- //args should be an array of arguments
- handler.func.apply(undefined, parsedArgs);
- }
- });
- //Remove the once listeners
- _handlers[name] = _handlers[name].filter(function (handler) {
- return !handler.once;
- });
- //Clean up the array if it is empty
- if (_handlers[name].length === 0) {
- delete _handlers[name];
- //No need to call remove since this would only be for callbacks
- }
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/exception.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/exception.js b/lib/blackberry10/plugin/blackberry10/exception.js
deleted file mode 100644
index 515d46d..0000000
--- a/lib/blackberry10/plugin/blackberry10/exception.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-module.exports = {
-
- types: {
- Application: "Application",
- ArgumentLength: "ArgumentLength",
- ArgumentType: "ArgumentType",
- Argument: "Argument",
- NotificationType: "NotificationType",
- NotificationStateType: "NotificationStateType",
- DomObjectNotFound: "DomObjectNotFound",
- MethodNotImplemented: "MethodNotImplemented",
- InvalidState: "InvalidState",
- ApplicationState: "ApplicationState"
- },
-
- handle: function handle(exception, reThrow) {
- reThrow = reThrow || false;
-
- var eMsg = exception.message || "exception caught!",
- msg = eMsg + "\n\n" + (exception.stack || "*no stack provided*") + "\n\n";
-
- console.error(msg);
-
- if (reThrow) {
- throw exception;
- }
- },
-
- raise: function raise(exceptionType, message, customExceptionObject) {
- var obj = customExceptionObject || {
- type: "",
- message: "",
-
- toString: function () {
- var result = this.name + ': "' + this.message + '"';
-
- if (this.stack) {
- result += "\n" + this.stack;
- }
- return result;
- }
- };
-
- message = message || "";
-
- obj.name = exceptionType;
- obj.type = exceptionType;
- // TODO: include the exception objects original message if exists
- obj.message = message;
-
- throw obj;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/fileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/fileTransfer.js b/lib/blackberry10/plugin/blackberry10/fileTransfer.js
deleted file mode 100644
index b4756b3..0000000
--- a/lib/blackberry10/plugin/blackberry10/fileTransfer.js
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/*global Blob:false */
-var cordova = require('cordova'),
- nativeResolveLocalFileSystemURI = function(uri, success, fail) {
- if (uri.substring(0,11) !== "filesystem:") {
- uri = "filesystem:" + uri;
- }
- resolveLocalFileSystemURI(uri, success, fail);
- },
- xhr;
-
-function getParentPath(filePath) {
- var pos = filePath.lastIndexOf('/');
- return filePath.substring(0, pos + 1);
-}
-
-function getFileName(filePath) {
- var pos = filePath.lastIndexOf('/');
- return filePath.substring(pos + 1);
-}
-
-function checkURL(url) {
- return url.indexOf(' ') === -1 ? true : false;
-}
-
-module.exports = {
- abort: function () {
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
- },
-
- upload: function(args, win, fail) {
- var filePath = args[0],
- server = args[1],
- fileKey = args[2],
- fileName = args[3],
- mimeType = args[4],
- params = args[5],
- /*trustAllHosts = args[6],*/
- chunkedMode = args[7],
- headers = args[8];
-
- if (!checkURL(server)) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, server, filePath));
- }
-
- nativeResolveLocalFileSystemURI(filePath, function(entry) {
- entry.file(function(file) {
- function uploadFile(blobFile) {
- var fd = new FormData();
-
- fd.append(fileKey, blobFile, fileName);
- for (var prop in params) {
- if(params.hasOwnProperty(prop)) {
- fd.append(prop, params[prop]);
- }
- }
-
- xhr = new XMLHttpRequest();
- xhr.open("POST", server);
- xhr.onload = function(evt) {
- if (xhr.status === 200) {
- var result = new FileUploadResult();
- result.bytesSent = file.size;
- result.responseCode = xhr.status;
- result.response = xhr.response;
- win(result);
- } else if (xhr.status === 404) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, server, filePath, xhr.status, xhr.response));
- } else {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, server, filePath, xhr.status, xhr.response));
- }
- };
- xhr.ontimeout = function(evt) {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, server, filePath, xhr.status, xhr.response));
- };
- xhr.onerror = function () {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, server, filePath, this.status, xhr.response));
- };
- xhr.onprogress = function (evt) {
- win(evt);
- };
-
- for (var header in headers) {
- if (headers.hasOwnProperty(header)) {
- xhr.setRequestHeader(header, headers[header]);
- }
- }
-
- xhr.send(fd);
- }
-
- var bytesPerChunk;
- if (chunkedMode === true) {
- bytesPerChunk = 1024 * 1024; // 1MB chunk sizes.
- } else {
- bytesPerChunk = file.size;
- }
- var start = 0;
- var end = bytesPerChunk;
- while (start < file.size) {
- var chunk = file.slice(start, end, mimeType);
- uploadFile(chunk);
- start = end;
- end = start + bytesPerChunk;
- }
- }, function(error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR, server, filePath));
- });
- }, function(error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR, server, filePath));
- });
-
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
- },
-
- download: function (args, win, fail) {
- var source = args[0],
- target = args[1],
- headers = args[4],
- fileWriter;
-
- if (!checkURL(source)) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, source, target));
- }
-
- xhr = new XMLHttpRequest();
-
- function writeFile(entry) {
- entry.createWriter(function (writer) {
- fileWriter = writer;
- fileWriter.onwriteend = function (evt) {
- if (!evt.target.error) {
- win(entry);
- } else {
- fail(evt.target.error);
- }
- };
- fileWriter.onerror = function (evt) {
- fail(evt.target.error);
- };
- fileWriter.write(new Blob([xhr.response]));
- }, function (error) {
- fail(error);
- });
- }
-
- xhr.onerror = function (e) {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, source, target, xhr.status, xhr.response));
- };
-
- xhr.onload = function () {
- if (xhr.readyState === xhr.DONE) {
- if (xhr.status === 200 && xhr.response) {
- nativeResolveLocalFileSystemURI(getParentPath(target), function (dir) {
- dir.getFile(getFileName(target), {create: true}, writeFile, function (error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR, source, target, xhr.status, xhr.response));
- });
- }, function (error) {
- fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR, source, target, xhr.status, xhr.response));
- });
- } else if (xhr.status === 404) {
- fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, source, target, xhr.status, xhr.response));
- } else {
- fail(new FileTransferError(FileTransferError.CONNECTION_ERR, source, target, xhr.status, xhr.response));
- }
- }
- };
- xhr.onprogress = function (evt) {
- win(evt);
- };
-
- xhr.open("GET", source, true);
- for (var header in headers) {
- if (headers.hasOwnProperty(header)) {
- xhr.setRequestHeader(header, headers[header]);
- }
- }
- xhr.send();
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/fileUtils.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/fileUtils.js b/lib/blackberry10/plugin/blackberry10/fileUtils.js
deleted file mode 100644
index e26e4e9..0000000
--- a/lib/blackberry10/plugin/blackberry10/fileUtils.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-function convertPath(url) {
- return decodeURI(url).substring(11).replace(/\/$/, '');
-}
-
-module.exports = {
-
- createEntry: function (entry) {
- var cordovaEntry;
- if (entry.isFile) {
- cordovaEntry = new window.FileEntry(entry.name, convertPath(entry.toURL()));
- } else {
- cordovaEntry = new window.DirectoryEntry(entry.name, convertPath(entry.toURL()));
- }
- cordovaEntry.nativeEntry = entry;
- return cordovaEntry;
- },
-
- getEntryForURI: function (uri, success, fail) {
- //TODO: account for local vs file system
- window.resolveLocalFileSystemURI(uri, success, fail);
- },
-
- getFileSystemName: function (fs) {
- return (fs.name.indexOf('Persistent') != -1) ? 'persistent' : 'temporary';
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/magnetometer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/magnetometer.js b/lib/blackberry10/plugin/blackberry10/magnetometer.js
deleted file mode 100644
index 72aa90e..0000000
--- a/lib/blackberry10/plugin/blackberry10/magnetometer.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var cordova = require('cordova'),
- callback;
-
-module.exports = {
- start: function (args, win, fail) {
- window.removeEventListener("deviceorientation", callback);
- callback = function (orientation) {
- var heading = 360 - orientation.alpha;
- win({
- magneticHeading: heading,
- trueHeading: heading,
- headingAccuracy: 0,
- timestamp: orientation.timeStamp
- });
- };
-
- window.addEventListener("deviceorientation", callback);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- stop: function (args, win, fail) {
- window.removeEventListener("deviceorientation", callback);
- return { "status" : cordova.callbackStatus.OK, "message" : "removed" };
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/media.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/media.js b/lib/blackberry10/plugin/blackberry10/media.js
deleted file mode 100644
index a141a99..0000000
--- a/lib/blackberry10/plugin/blackberry10/media.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var cordova = require('cordova'),
- audioObjects = {};
-
-module.exports = {
- create: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- src = args[1];
-
- if (typeof src == "undefined"){
- audioObjects[id] = new Audio();
- } else {
- audioObjects[id] = new Audio(src);
- }
-
- return {"status" : 1, "message" : "Audio object created" };
- },
- startPlayingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (args.length === 1 || typeof args[1] == "undefined" ) {
- return {"status" : 9, "message" : "Media source argument not found"};
- }
-
- if (audio) {
- audio.pause();
- audioObjects[id] = undefined;
- }
-
- audio = audioObjects[id] = new Audio(args[1]);
- audio.play();
- return {"status" : 1, "message" : "Audio play started" };
- },
- stopPlayingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- audio.pause();
- audioObjects[id] = undefined;
-
- return {"status" : 1, "message" : "Audio play stopped" };
- },
- seekToAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- result = {"status" : 2, "message" : "Audio Object has not been initialized"};
- } else if (args.length === 1) {
- result = {"status" : 9, "message" : "Media seek time argument not found"};
- } else {
- try {
- audio.currentTime = args[1];
- } catch (e) {
- console.log('Error seeking audio: ' + e);
- return {"status" : 3, "message" : "Error seeking audio: " + e};
- }
-
- result = {"status" : 1, "message" : "Seek to audio succeeded" };
- }
- return result;
- },
- pausePlayingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- audio.pause();
-
- return {"status" : 1, "message" : "Audio paused" };
- },
- getCurrentPositionAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- return {"status" : 1, "message" : audio.currentTime };
- },
- getDuration: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (!audio) {
- return {"status" : 2, "message" : "Audio Object has not been initialized"};
- }
-
- return {"status" : 1, "message" : audio.duration };
- },
- startRecordingAudio: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- if (args.length <= 1) {
- return {"status" : 9, "message" : "Media start recording, insufficient arguments"};
- }
-
- blackberry.media.microphone.record(args[1], win, fail);
- return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
- },
- stopRecordingAudio: function (args, win, fail) {
- },
- release: function (args, win, fail) {
- if (!args.length) {
- return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
- }
-
- var id = args[0],
- audio = audioObjects[id],
- result;
-
- if (audio) {
- if(audio.src !== ""){
- audio.src = undefined;
- }
- audioObjects[id] = undefined;
- //delete audio;
- }
-
- result = {"status" : 1, "message" : "Media resources released"};
-
- return result;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/utils.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/utils.js b/lib/blackberry10/plugin/blackberry10/utils.js
deleted file mode 100644
index 3a630da..0000000
--- a/lib/blackberry10/plugin/blackberry10/utils.js
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var self,
- exception = require('cordova/plugin/blackberry10/exception');
-
-function S4() {
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
-}
-
-self = module.exports = {
- validateNumberOfArguments: function (lowerBound, upperBound, numberOfArguments, customExceptionType, customExceptionMessage, customExceptionObject) {
-
- customExceptionMessage = customExceptionMessage || "";
-
- if (arguments.length < 3 || arguments.length > 6) {
- exception.raise(exception.types.Argument, "Wrong number of arguments when calling: validateNumberOfArguments()");
- }
-
- if (isNaN(lowerBound) && isNaN(upperBound) && isNaN(numberOfArguments)) {
- exception.raise(exception.types.ArgumentType, "(validateNumberOfArguments) Arguments are not numbers");
- }
-
- lowerBound = parseInt(lowerBound, 10);
- upperBound = parseInt(upperBound, 10);
- numberOfArguments = parseInt(numberOfArguments, 10);
-
- if (numberOfArguments < lowerBound || numberOfArguments > upperBound) {
- exception.raise((customExceptionType || exception.types.ArgumentLength), (customExceptionMessage + "\n\nWrong number of arguments"), customExceptionObject);
- }
-
- },
-
- validateArgumentType: function (arg, argType, customExceptionType, customExceptionMessage, customExceptionObject) {
- var invalidArg = false,
- msg;
-
- switch (argType) {
- case "array":
- if (!arg instanceof Array) {
- invalidArg = true;
- }
- break;
- case "date":
- if (!arg instanceof Date) {
- invalidArg = true;
- }
- break;
- case "integer":
- if (typeof arg === "number") {
- if (arg !== Math.floor(arg)) {
- invalidArg = true;
- }
- }
- else {
- invalidArg = true;
- }
- break;
- default:
- if (typeof arg !== argType) {
- invalidArg = true;
- }
- break;
- }
-
- if (invalidArg) {
- msg = customExceptionMessage + ("\n\nInvalid Argument type. argument: " + arg + " ==> was expected to be of type: " + argType);
- exception.raise((customExceptionType || exception.types.ArgumentType), msg, customExceptionObject);
- }
- },
-
- validateMultipleArgumentTypes: function (argArray, argTypeArray, customExceptionType, customExceptionMessage, customExceptionObject) {
- for (var i = 0; i < argArray.length; i++) {
- this.validateArgumentType(argArray[i], argTypeArray[i], customExceptionType, customExceptionMessage, customExceptionObject);
- }
- },
-
- arrayContains: function (array, obj) {
- var i = array.length;
- while (i--) {
- if (array[i] === obj) {
- return true;
- }
- }
- return false;
- },
-
- some: function (obj, predicate, scope) {
- if (obj instanceof Array) {
- return obj.some(predicate, scope);
- }
- else {
- var values = self.map(obj, predicate, scope);
-
- return self.reduce(values, function (some, value) {
- return value ? value : some;
- }, false);
- }
- },
-
- count: function (obj) {
- return self.sum(obj, function (total) {
- return 1;
- });
- },
-
- sum: function (obj, selector, scope) {
- var values = self.map(obj, selector, scope);
- return self.reduce(values, function (total, value) {
- return total + value;
- });
- },
-
- max: function (obj, selector, scope) {
- var values = self.map(obj, selector, scope);
- return self.reduce(values, function (max, value) {
- return max < value ? value : max;
- }, Number.MIN_VALUE);
- },
-
- min: function (obj, selector, scope) {
- var values = self.map(obj, selector, scope);
- return self.reduce(values, function (min, value) {
- return min > value ? value : min;
- }, Number.MAX_VALUE);
- },
-
- forEach: function (obj, action, scope) {
- if (obj instanceof Array) {
- return obj.forEach(action, scope);
- }
- else {
- self.map(obj, action, scope);
- }
- },
-
- filter: function (obj, predicate, scope) {
- if (obj instanceof Array) {
- return obj.filter(predicate, scope);
- }
- else {
- var result = [];
- self.forEach(obj, function (value, index) {
- if (predicate.apply(scope, [value, index])) {
- result.push(value);
- }
-
- }, scope);
-
- return result;
- }
- },
-
- reduce: function (obj, func, init, scope) {
- var i,
- initial = init === undefined ? 0 : init,
- result = initial;
-
-
- if (obj instanceof Array) {
- return obj.reduce(func, initial);
- }
- else if (obj instanceof NamedNodeMap) {
- for (i = 0; i < obj.length; i++) {
- result = func.apply(scope, [result, obj[i], i]);
- }
- }
- else {
- for (i in obj) {
- if (obj.hasOwnProperty(i)) {
- result = func.apply(scope, [result, obj[i], i]);
- }
- }
- }
-
- return result;
-
- },
-
- map: function (obj, func, scope) {
- var i,
- returnVal = null,
- result = [];
-
- if (obj instanceof Array) {
- return obj.map(func, scope);
- }
- else if (obj instanceof NamedNodeMap) {
- for (i = 0; i < obj.length; i++) {
- returnVal = func.apply(scope, [obj[i], i]);
- result.push(returnVal);
- }
- }
- else {
- for (i in obj) {
- if (obj.hasOwnProperty(i)) {
- returnVal = func.apply(scope, [obj[i], i]);
- result.push(returnVal);
- }
- }
- }
-
- return result;
- },
-
- series: function (tasks, callback) {
-
- var execute = function () {
- var args = [],
- task;
-
- if (tasks.length) {
- task = tasks.shift();
- args = args.concat(task.args).concat(execute);
- task.func.apply(this, args);
- }
- else {
- callback.func.apply(this, callback.args);
- }
- };
-
- execute();
- },
-
- regexSanitize: function (regexString) {
- return regexString.replace("^", "\\^")
- .replace("$", "\\$")
- .replace("(", "\\(")
- .replace(")", "\\)")
- .replace("<", "\\<")
- .replace("[", "\\[")
- .replace("{", "\\{")
- .replace(/\\/, "\\\\")
- .replace("|", "\\|")
- .replace(">", "\\>")
- .replace(".", "\\.")
- .replace("*", "\\*")
- .replace("+", "\\+")
- .replace("?", "\\?");
- },
-
- find: function (comparison, collection, startInx, endInx, callback) {
- var results = [],
- compare = function (s, pattern) {
-
- if (typeof(s) !== "string" || pattern === null) {
- return s === pattern;
- }
-
- var regex = pattern.replace(/\./g, "\\.")
- .replace(/\^/g, "\\^")
- .replace(/\*/g, ".*")
- .replace(/\\\.\*/g, "\\*");
-
- regex = "^".concat(regex, "$");
-
- return !!s.match(new RegExp(regex, "i"));
- };
-
- self.forEach(collection, function (c) {
- var match,
- fail = false;
-
- self.forEach(comparison, function (value, key) {
- if (!fail && value !== undefined) {
-
- if (compare(c[key], value)) {
- match = c;
- }
- else {
- fail = true;
- match = null;
- }
- }
- });
-
- if (match) {
- results.push(match);
- }
- });
-
- if (callback) {
- if (startInx === undefined) {
- startInx = 0;
- }
- if (endInx === undefined) {
- endInx = results.length;
- }
- if (startInx === endInx) {
- endInx = startInx + 1;
- }
-
- callback.apply(null, [results.slice(startInx, endInx)]);
- }
- },
-
- mixin: function (mixin, to) {
- Object.getOwnPropertyNames(mixin).forEach(function (prop) {
- if (Object.hasOwnProperty.call(mixin, prop)) {
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(mixin, prop));
- }
- });
- return to;
- },
-
- copy: function (obj) {
- var i,
- newObj = (obj === null ? false : global.toString.call(obj) === "[object Array]") ? [] : {};
-
- if (typeof obj === 'number' ||
- typeof obj === 'string' ||
- typeof obj === 'boolean' ||
- obj === null ||
- obj === undefined) {
- return obj;
- }
-
- if (obj instanceof Date) {
- return new Date(obj);
- }
-
- if (obj instanceof RegExp) {
- return new RegExp(obj);
- }
-
- for (i in obj) {
- if (obj.hasOwnProperty(i)) {
- if (obj[i] && typeof obj[i] === "object") {
- if (obj[i] instanceof Date) {
- newObj[i] = obj[i];
- }
- else {
- newObj[i] = self.copy(obj[i]);
- }
- }
- else {
- newObj[i] = obj[i];
- }
- }
- }
-
- return newObj;
- },
-
- startsWith : function (str, substr) {
- return str.indexOf(substr) === 0;
- },
-
- endsWith : function (str, substr) {
- return str.indexOf(substr, str.length - substr.length) !== -1;
- },
-
- parseUri : function (str) {
- var i, uri = {},
- key = [ "source", "scheme", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor" ],
- matcher = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(str);
-
- for (i = key.length - 1; i >= 0; i--) {
- uri[key[i]] = matcher[i] || "";
- }
-
- return uri;
- },
-
- // uri - output from parseUri
- isAbsoluteURI : function (uri) {
- if (uri && uri.source) {
- return uri.relative !== uri.source;
- }
-
- return false;
- },
-
- fileNameToImageMIME : function (fileName) {
-
- var extensionsToMIME = {},
- ext;
-
- extensionsToMIME.png = 'image/png';
- extensionsToMIME.jpg = 'image/jpeg';
- extensionsToMIME.jpe = 'image/jpeg';
- extensionsToMIME.jpeg = 'image/jpeg';
- extensionsToMIME.gif = 'image/gif';
- extensionsToMIME.bmp = 'image/bmp';
- extensionsToMIME.bm = 'image/bmp';
- extensionsToMIME.svg = 'image/svg+xml';
- extensionsToMIME.tif = 'image/tiff';
- extensionsToMIME.tiff = 'image/tiff';
-
- ext = fileName.split('.').pop();
- return extensionsToMIME[ext];
- },
-
- isLocalURI : function (uri) {
- return uri && uri.scheme && "local:///".indexOf(uri.scheme.toLowerCase()) !== -1;
- },
-
- isFileURI : function (uri) {
- return uri && uri.scheme && "file://".indexOf(uri.scheme.toLowerCase()) !== -1;
- },
-
- isHttpURI : function (uri) {
- return uri && uri.scheme && "http://".indexOf(uri.scheme.toLowerCase()) !== -1;
- },
-
- isHttpsURI : function (uri) {
- return uri && uri.scheme && "https://".indexOf(uri.scheme.toLowerCase()) !== -1;
- },
-
- // Checks if the specified uri starts with 'data:'
- isDataURI : function (uri) {
- return uri && uri.scheme && "data:".indexOf(uri.scheme.toLowerCase()) !== -1;
- },
-
- performExec : function (featureId, property, args) {
- var result;
-
- window.webworks.exec(function (data, response) {
- result = data;
- }, function (data, response) {
- throw data;
- }, featureId, property, args, true);
-
- return result;
- },
-
- inNode : function () {
- return !!require.resolve;
- },
-
- requireWebview : function () {
- return require("./webview");
- },
- convertDataToBinary : function (data, dataEncoding) {
- var rawData,
- uint8Array,
- i;
-
- if (data) {
- if (dataEncoding.toLowerCase() === "base64") {
- rawData = window.atob(data);
- }
- else {
- rawData = data;
- }
-
- uint8Array = new Uint8Array(new ArrayBuffer(rawData.length));
-
- for (i = 0; i < uint8Array.length; i++) {
- uint8Array[i] = rawData.charCodeAt(i);
- }
-
- return uint8Array.buffer;
- }
- },
- getBlobWithArrayBufferAsData : function (data, dataEncoding) {
- var rawData,
- blobBuilderObj = new window.WebKitBlobBuilder();
- rawData = this.convertDataToBinary(data, dataEncoding);
- blobBuilderObj.append(rawData);
-
- return blobBuilderObj.getBlob("arraybuffer");
- },
- loadModule: function (module) {
- return require(module);
- },
- loadExtensionModule: function (extBasename, path) {
- var ext = require("./manifest")[extBasename];
-
- if (ext) {
- return require("../ext/" + ext.namespace + "/" + path);
- } else {
- return null;
- }
- },
- hasPermission: function (config, permission) {
- if (config && config.permissions && config.permissions.length) {
- return config.permissions.indexOf(permission) >= 0;
- }
-
- return false;
- },
- guid: function () {
- return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
- },
- getURIPrefix: function () {
- return "http://localhost:8472/";
- },
- translatePath: function (path) {
- if (path.indexOf("local:///") === 0) {
- var sourceDir = window.qnx.webplatform.getApplication().getEnv("HOME"); //leading slashes need to be removed
- path = "file:///" + sourceDir.replace(/^\/*/, '') + "/../app/native/" + path.replace(/local:\/\/\//, '');
- }
- return path;
- },
- invokeInBrowser: function (url) {
- var request = {
- uri: url,
- target: "sys.browser"
- };
- window.qnx.webplatform.getApplication().invocation.invoke(request);
- },
- isPersonal: function () {
- return window.qnx.webplatform.getApplication().getEnv("PERIMETER") === "personal";
- },
- deepclone: function (obj) {
- var newObj = obj instanceof Array ? [] : {},
- key;
-
- if (typeof obj === 'number' ||
- typeof obj === 'string' ||
- typeof obj === 'boolean' ||
- obj === null ||
- obj === undefined) {
- return obj;
- }
-
- if (obj instanceof Date) {
- return new Date(obj);
- }
-
- if (obj instanceof RegExp) {
- return new RegExp(obj);
- }
-
- for (key in obj) {
- if (obj.hasOwnProperty(key)) {
- if (obj[key] && typeof obj[key] === "object") {
- newObj[key] = self.deepclone(obj[key]);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
-
- return newObj;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/blackberry10/plugin/blackberry10/vibrate.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/vibrate.js b/lib/blackberry10/plugin/blackberry10/vibrate.js
deleted file mode 100644
index ba05294..0000000
--- a/lib/blackberry10/plugin/blackberry10/vibrate.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-module.exports = function (time) {
- var proto = Object.getPrototypeOf(navigator);
-
- if (proto && proto.vibrate) {
- proto.vibrate(time);
- } else if (proto && proto.webkitVibrate) {
- //Older OS contain webkit prefix
- proto.webkitVibrate(time);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/lib/scripts/bootstrap-blackberry10.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-blackberry10.js b/lib/scripts/bootstrap-blackberry10.js
index 1e40bae..691faf0 100644
--- a/lib/scripts/bootstrap-blackberry10.js
+++ b/lib/scripts/bootstrap-blackberry10.js
@@ -18,7 +18,7 @@
* under the License.
*
*/
-
+/*global cordova*/
(function () {
var docAddEventListener = document.addEventListener,
webworksReady = false,
@@ -50,7 +50,7 @@
var params = {};
function composeUri() {
- return require("cordova/plugin/blackberry10/utils").getURIPrefix() + functionUri;
+ return "http://localhost:8472/" + functionUri;
}
function createXhrRequest(uri, isAsync) {
@@ -119,8 +119,7 @@
"value": value,
"writable": false
});
- },
- event: require("cordova/plugin/blackberry10/event")
+ }
};
require("cordova/channel").onPluginsReady.subscribe(function () {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/test/blackberry10/test.compass.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.compass.js b/test/blackberry10/test.compass.js
deleted file mode 100644
index 19b231b..0000000
--- a/test/blackberry10/test.compass.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-xdescribe("blackberry10 compass", function () {
- var compass = require('cordova/plugin/blackberry10/compass'),
- cordova = require('cordova'),
- exec = require('cordova/exec'),
- utils = require('cordova/utils'),
- CompassHeading = require('cordova/plugin/CompassHeading'),
- CompassError = require('cordova/plugin/CompassError'),
- win = jasmine.createSpy('win'),
- fail = jasmine.createSpy('fail');
-
- beforeEach(function () {
- window.start = jasmine.createSpy('start');
- window.stop = jasmine.createSpy('stop');
- window.removeListeners = jasmine.createSpy('removeListeners');
- global.listeners = [];
-
- });
-
- afterEach(function () {
-
- });
-
-
- describe("watchHeading", function(){
- it('should return that successCallback is not a function', function(){
- expect(compass.getCurrentHeading).toThrow("getCurrentHeading must be called with at least a success callback function as first parameter.");
- });
-
- it('should see that start() was called', function(){
- compass.getCurrentHeading(win, fail);
- expect(listeners).toHaveBeenCalled();
- });
-
- });
-
- describe("clearWatch", function(){
-
-
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/test/blackberry10/test.event.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.event.js b/test/blackberry10/test.event.js
deleted file mode 100644
index 7d293b8..0000000
--- a/test/blackberry10/test.event.js
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-describe("blackberry10 event", function () {
- var event = require("cordova/plugin/blackberry10/event"),
- _window;
-
- beforeEach(function () {
- _window = {
- webworks: {
- exec: jasmine.createSpy("window.webworks.exec")
- }
- };
- window.webworks = _window.webworks;
- });
-
- afterEach(function () {
- delete window.webworks;
- });
-
- describe("add", function () {
-
- it("it can call webworks.exec action 'add' given valid featureId, eventName and callback", function () {
- var callback = function () {};
- event.add("blackberry.system.event", "foo", callback);
- expect(_window.webworks.exec).toHaveBeenCalledWith(undefined, undefined, "blackberry.system.event", "add", {"eventName": "foo"});
- event.remove("blackberry.system.event", "foo", callback);
- });
-
- it("it will not call webworks.exec for multiple callbacks", function () {
- var callback = jasmine.createSpy(),
- callback2 = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- event.add("blackberry.system.event", "foo", callback2);
- expect(_window.webworks.exec).toHaveBeenCalledWith(undefined, undefined, "blackberry.system.event", "add", {"eventName": "foo"});
- expect(_window.webworks.exec.callCount).toEqual(1);
- event.remove("blackberry.system.event", "foo", callback);
- event.remove("blackberry.system.event", "foo", callback2);
- });
-
- it("will not register duplicate callbacks if it is the only registered callback for the event", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- event.add("blackberry.system.event", "foo", callback);
- event.trigger("foo", '[{"id": 1}]');
- expect(callback).toHaveBeenCalledWith({"id": 1});
- expect(callback.callCount).toEqual(1);
- event.remove("blackberry.system.event", "foo", callback);
- });
-
- it("will not register duplicate callbacks if it is not the only registered callback for the event", function () {
- var firstCallback = jasmine.createSpy(),
- secondCallback = jasmine.createSpy(),
- thirdCallback = jasmine.createSpy();
-
- event.add("blackberry.system.event", "foo", firstCallback);
- event.add("blackberry.system.event", "foo", secondCallback);
- event.add("blackberry.system.event", "foo", thirdCallback);
- event.add("blackberry.system.event", "foo", firstCallback);
- event.trigger("foo", null);
- expect(firstCallback.callCount).toEqual(1);
- event.remove("blackberry.system.event", "foo", firstCallback);
- event.remove("blackberry.system.event", "foo", secondCallback);
- event.remove("blackberry.system.event", "foo", thirdCallback);
- });
-
- it("will register two distinct callbacks", function () {
- var callback = jasmine.createSpy(),
- callback2 = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- event.add("blackberry.system.event", "foo", callback2);
- event.trigger("foo", '[{"id": 1}]');
- expect(callback).toHaveBeenCalledWith({"id": 1});
- expect(callback2).toHaveBeenCalledWith({"id": 1});
- event.remove("blackberry.system.event", "foo", callback);
- event.remove("blackberry.system.event", "foo", callback2);
- });
- });
-
- describe("once", function () {
- it("will call webworks.exec action 'once' given valid featureId, eventName and callback", function () {
- var callback = function () {};
- event.once("blackberry.system.event", "foo", callback);
- expect(_window.webworks.exec).toHaveBeenCalledWith(undefined, undefined, "event", "once", {"eventName": "foo"});
- event.remove("blackberry.system.event", "foo", callback);
- });
- });
-
- describe("remove", function () {
- it("can call webworks.exec action 'remove' given valid featureId, eventName and callback", function () {
- var cb = jasmine.createSpy();
- event.add("blackberry.system.event", "a", cb);
- event.remove("blackberry.system.event", "a", cb);
- expect(_window.webworks.exec).toHaveBeenCalledWith(undefined, undefined, "blackberry.system.event", "remove", {"eventName": "a"});
- });
- });
-
- describe("trigger", function () {
- it("will invoke callback if event has been added", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- event.trigger("foo", '[{"id": 1}]');
- expect(callback).toHaveBeenCalledWith({"id": 1});
- event.remove("blackberry.system.event", "foo", callback);
- });
-
- it("will invoke callback if no args are provided", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.event", "pause", callback);
- event.trigger("pause");
- expect(callback).toHaveBeenCalled();
- event.remove("blackberry.system.event", "foo", callback);
- });
-
- it("will invoke callback with multiple args", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.event", "pause", callback);
- event.trigger("pause", "[1,2,3,4,5]");
- expect(callback).toHaveBeenCalledWith(1, 2, 3, 4, 5);
- event.remove("blackberry.system.event", "foo", callback);
- });
-
- it("will not invoke callback if event has been removed", function () {
- var cb = jasmine.createSpy();
- event.add("blackberry.system.event", "c", cb);
- event.remove("blackberry.system.event", "c", cb);
- event.trigger("c", {"id": 1});
- expect(cb).not.toHaveBeenCalled();
- });
-
- it("will remove once listeners after they are triggered", function () {
- var callback = jasmine.createSpy();
- event.once("blackberry.system.event", "foo", callback);
- event.trigger("foo", '[{"id": 1}]');
- event.trigger("foo", '[{"id": 1}]');
- expect(callback).toHaveBeenCalledWith({"id": 1});
- expect(callback.callCount).toEqual(1);
- });
-
- it("will not remove on listeners after they are triggered", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- event.trigger("foo", '[{"id": 1}]');
- event.trigger("foo", '[{"id": 1}]');
- expect(callback).toHaveBeenCalledWith({"id": 1});
- expect(callback.callCount).toEqual(2);
- event.remove("blackberry.system.event", "foo", callback);
- });
- });
-
- describe("isOn", function () {
- it("returns false with no listeners", function () {
- expect(event.isOn("foo")).toEqual(false);
- });
-
- it("returns true with listeners", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- expect(event.isOn("foo")).toEqual(true);
- event.remove("blackberry.system.event", "foo", callback);
- });
-
- it("Updates properly once listeners are removed", function () {
- var callback = jasmine.createSpy();
- event.add("blackberry.system.event", "foo", callback);
- event.remove("blackberry.system.event", "foo", callback);
- expect(event.isOn("foo")).toEqual(false);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/08a2641c/test/blackberry10/test.magnetometer.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.magnetometer.js b/test/blackberry10/test.magnetometer.js
deleted file mode 100644
index f9ad9b3..0000000
--- a/test/blackberry10/test.magnetometer.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry10 magnetometer", function () {
- var magnetometer = require('cordova/plugin/blackberry10/magnetometer'),
- cordova = require('cordova');
-
- beforeEach(function () {
- spyOn(window, "removeEventListener");
- spyOn(window, "addEventListener");
- });
-
- describe("start", function(){
- it('should return no result', function(){
- expect(magnetometer.start()).toEqual({
- status: cordova.callbackStatus.NO_RESULT,
- message: "WebWorks Is On It"
- });
- });
-
- it('should remove the event listener', function(){
- magnetometer.start();
- expect(window.removeEventListener).toHaveBeenCalledWith("deviceorientation", jasmine.any(Function));
- });
-
- it('should add an event listener', function(){
- magnetometer.start();
- expect(window.addEventListener).toHaveBeenCalledWith("deviceorientation", jasmine.any(Function));
- });
-
- it('call the win callback with the data from the event', function(){
- var win = jasmine.createSpy('win');
- magnetometer.start({}, win);
-
- window.addEventListener.mostRecentCall.args[1]({
- alpha: 60,
- timeStamp: "bout that time, eh chap?"
- });
-
- expect(win).toHaveBeenCalledWith({
- magneticHeading: 300,
- trueHeading: 300,
- headingAccuracy: 0,
- timestamp: "bout that time, eh chap?"
- });
- });
- });
-
- describe('stop', function(){
- it('should return OK', function(){
- expect(magnetometer.stop()).toEqual({
- status: cordova.callbackStatus.OK,
- message: "removed"
- });
- });
-
- it('should remove the event listener', function(){
- magnetometer.stop();
- expect(window.removeEventListener).toHaveBeenCalledWith("deviceorientation", jasmine.any(Function));
- });
- });
-});