mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2026-05-12 00:01:32 +08:00
The plugin now follows W 3 specs ; tests for screen.orientation.onchange pending
This commit is contained in:
committed by
Jesse MacFadyen
parent
f8207c4164
commit
bef03769de
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.cordova.screenorientationdemo" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<name>ScreenOrientationDemo</name>
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
<button id="btnLandPrimary">Landscape - Primary</button>
|
||||
</div>
|
||||
<button id="btnAny">Unlock</button>
|
||||
<button id="btnOnchange">Onchange</button>
|
||||
<button id="btnAddEvtListener">Add Event</button>
|
||||
</div>
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
|
||||
+14
-1
@@ -66,8 +66,13 @@ var app = {
|
||||
btnAny.addEventListener("click", function() {
|
||||
screen.orientation.unlock();
|
||||
});
|
||||
btnOnchange.addEventListener("click", function() {
|
||||
screen.orientation.onchange = myFunction1();
|
||||
|
||||
|
||||
});
|
||||
btnAddEvtListener.addEventListener("click", function() {
|
||||
screen.orientation.addEventListener('change', myFunction2(), true);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
@@ -84,4 +89,12 @@ var app = {
|
||||
}
|
||||
};
|
||||
|
||||
function myFunction1() {
|
||||
alert('This change listener uses screen.orientation.onchange');
|
||||
}
|
||||
|
||||
function myFunction2() {
|
||||
alert('This change listener uses screen.orientation.addEventListener');
|
||||
}
|
||||
|
||||
app.initialize();
|
||||
Reference in New Issue
Block a user