You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/14 23:13:06 UTC

[27/38] js commit: [BlackBerry10] Removed builder from platform.js

[BlackBerry10] Removed builder from platform.js

- builder is deprecated, switching to moduleMapper
- removed dependency on blackberry10/plugin/blackberry10/platform.js

Reviewed by Bryan Higgins <bh...@blackberry.com>
Tested by Tracy Li <tl...@blackberry.com>


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/acaf8370
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/acaf8370
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/acaf8370

Branch: refs/heads/3.0.0
Commit: acaf837055c235085888683bbac6f85d12d4fc42
Parents: 188c17d
Author: jkeshavarzi <jk...@blackberry.com>
Authored: Wed Apr 24 14:25:53 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri May 3 09:50:05 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/platform.js                     |   16 +--
 lib/blackberry10/plugin/blackberry10/platform.js |   71 ----------
 test/blackberry10/test.platform.js               |  117 -----------------
 3 files changed, 7 insertions(+), 197 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/acaf8370/lib/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/platform.js b/lib/blackberry10/platform.js
index 7b6bb2a..5f11f7c 100644
--- a/lib/blackberry10/platform.js
+++ b/lib/blackberry10/platform.js
@@ -22,18 +22,16 @@
 module.exports = {
     id: "blackberry10",
     initialize: function() {
-        var builder = require('cordova/builder'),
-            modulemapper = require('cordova/modulemapper'),
-            platform = require('cordova/plugin/blackberry10/platform');
-
-        builder.buildIntoButDoNotClobber(platform.defaults, window);
-        builder.buildIntoAndClobber(platform.clobbers, window);
-        builder.buildIntoAndMerge(platform.merges, window);
+        var modulemapper = require('cordova/modulemapper'),
+            cordova = require('cordova');
 
         modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
         modulemapper.loadMatchingModules(new RegExp('cordova/blackberry10/.*bbsymbols$'));
-        modulemapper.mapModules(window);
 
-        platform.initialize();
+        modulemapper.clobbers('cordova/plugin/blackberry10/vibrate', 'navigator.notification.vibrate');
+        modulemapper.clobbers('cordova/plugin/File', 'navigator.File');
+        modulemapper.merges('cordova/plugin/blackberry10/compass', 'navigator.compass');
+
+        modulemapper.mapModules(window);
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/acaf8370/lib/blackberry10/plugin/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/platform.js b/lib/blackberry10/plugin/blackberry10/platform.js
deleted file mode 100644
index 231d890..0000000
--- a/lib/blackberry10/plugin/blackberry10/platform.js
+++ /dev/null
@@ -1,71 +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');
-
-module.exports = {
-    id: "blackberry10",
-    initialize: function () {
-        document.addEventListener("deviceready", function () {
-            /*
-             TODO
-            blackberry.event.addEventListener("pause", function () {
-                cordova.fireDocumentEvent("pause");
-            });
-            blackberry.event.addEventListener("resume", function () {
-                cordova.fireDocumentEvent("resume");
-            });
-            */
-            window.addEventListener("online", function () {
-                cordova.fireDocumentEvent("online");
-            });
-
-            window.addEventListener("offline", function () {
-                cordova.fireDocumentEvent("offline");
-            });
-        });
-    },
-    clobbers: {
-        navigator: {
-            children: {
-                notification: {
-                    children: {
-                        vibrate: {
-                            path: 'cordova/plugin/blackberry10/vibrate'
-                        }
-                    }
-                }
-            }
-        },
-        File: {
-            path: 'cordova/plugin/File'
-        }
-    },
-    merges: {
-        navigator: {
-            children: {
-                compass: {
-                    path: 'cordova/plugin/blackberry10/compass'
-                }
-            }
-        }
-    }
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/acaf8370/test/blackberry10/test.platform.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.platform.js b/test/blackberry10/test.platform.js
deleted file mode 100644
index 98789a1..0000000
--- a/test/blackberry10/test.platform.js
+++ /dev/null
@@ -1,117 +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 platform", function () {
-    var platform = require('cordova/plugin/blackberry10/platform'),
-        cordova = require('cordova');
-
-    beforeEach(function () {
-
-        global.blackberry = {
-            event:{
-                addEventListener: jasmine.createSpy('addEventListener')
-            }
-        }
-
-        spyOn(cordova, "fireDocumentEvent");
-
-        spyOn(document, "addEventListener").andCallFake(function(){
-            blackberry.event.addEventListener("pause", function(){
-                cordova.fireDocumentEvent("pause")
-            });
-            blackberry.event.addEventListener("resume", function(){
-                cordova.fireDocumentEvent("resume")
-            });
-
-            window.addEventListener("online", function(){
-                cordova.fireDocumentEvent("online");
-            });
-            window.addEventListener("offline", function(){
-                cordova.fireDocumentEvent("offline");
-            });
-        });
-        
-        spyOn(window, "addEventListener").andCallFake(function(){
-            cordova.fireDocumentEvent("online");
-            cordova.fireDocumentEvent("offline");
-        });
-    });
-
-    afterEach(function(){
-        delete global.blackberry;
-    });
-
-    describe("initialize", function(){
-        it('should add an event listener to document', function(){
-            platform.initialize();
-            expect(document.addEventListener).toHaveBeenCalledWith("deviceready", jasmine.any(Function));
-        });
-        it('should check if blackberry event addEventListener was called for pause', function(){
-            platform.initialize();
-            expect(blackberry.event.addEventListener).toHaveBeenCalledWith("pause", jasmine.any(Function));
-        });
-        it('should check if blackberry event addEventListener was called for resume', function(){
-            platform.initialize();     
-            expect(blackberry.event.addEventListener).toHaveBeenCalledWith("resume", jasmine.any(Function));
-        });
-        it('should check if window.addEventListener was called for online', function(){
-            platform.initialize();
-            expect(window.addEventListener).toHaveBeenCalledWith("online", jasmine.any(Function));
-            
-        });
-        it('should check if window.addEventListener was called for offline', function(){
-            platform.initialize();
-            expect(window.addEventListener).toHaveBeenCalledWith("offline", jasmine.any(Function));
-        });
-
-        it('should call cordova.fireDocumentEvent online', function(){
-            platform.initialize();
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("online");
-        });
-        it('should call cordova.fireDocumentEvent offline', function(){
-            platform.initialize();
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("offline");
-        });
-        it('should call cordova.fireDocumentEvent pause', function(){
-            delete global.blackberry;
-            global.blackberry = { event: { addEventListener: function(){ } } };
-            spyOn(blackberry.event, "addEventListener").andCallFake(function(){
-                cordova.fireDocumentEvent("pause");
-            });
-
-            platform.initialize();
-            
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("pause");
-        });
-        it('should call cordova.fireDocumentEvent resume', function(){
-            delete global.blackberry;
-            global.blackberry = { event: { addEventListener: function(){ } } };
-            spyOn(blackberry.event, "addEventListener").andCallFake(function(){
-                cordova.fireDocumentEvent("resume");
-            });
-
-            platform.initialize();
-            
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("resume");
-        });
-
-    });
-});