Skip to content
This repository was archived by the owner on Mar 25, 2019. It is now read-only.

Commit b5ed108

Browse files
author
ericwlange
committed
Prepared for 3.0-pre2
Fixed JavaDocs Protected JSContext.sync() again Updated example
1 parent 8ee2aec commit b5ed108

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

AndroidJSCore/AndroidJSCore/src/main/java/org/liquidplayer/webkit/javascriptcore/JSArrayBuffer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3434

3535
/**
3636
* A wrapper class for a JavaScript ArrayBuffer
37+
* @since 3.0
3738
*/
3839
public class JSArrayBuffer {
3940
/**
4041
* Creates a new array buffer of 'length' bytes
4142
* @param ctx the JSContext in which to create the ArrayBuffer
4243
* @param length the length in bytes of the ArrayBuffer
44+
* @since 3.0
4345
*/
4446
public JSArrayBuffer(JSContext ctx, int length) {
4547
JSFunction constructor = new JSFunction(ctx,"_ArrayBuffer",new String[] {"length"},
@@ -52,6 +54,7 @@ public JSArrayBuffer(JSContext ctx, int length) {
5254
* Treats an existing JSObject as an ArrayBuffer. It is up to the user to ensure the
5355
* underlying JSObject is actually an ArrayBuffer.
5456
* @param buffer The ArrayBuffer JSObject to wrap
57+
* @since 3.0
5558
*/
5659
public JSArrayBuffer(JSObject buffer) {
5760
mArrayBuffer = buffer;
@@ -61,6 +64,7 @@ public JSArrayBuffer(JSObject buffer) {
6164
/**
6265
* Gets underlying JSObject
6366
* @return JSObject representing the ArrayBuffer
67+
* @since 3.0
6468
*/
6569
public JSObject getJSObject() {
6670
return mArrayBuffer;
@@ -70,6 +74,7 @@ public JSObject getJSObject() {
7074
* JavaScript: ArrayBuffer.prototype.byteLength, see:
7175
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/byteLength
7276
* @return length of ArrayBuffer in bytes
77+
* @since 3.0
7378
*/
7479
public int byteLength() {
7580
return mArrayBuffer.property("byteLength").toNumber().intValue();
@@ -81,6 +86,7 @@ public int byteLength() {
8186
* @param arg the argument to be checked
8287
* @return true if arg is one of the ArrayBuffer views, such as typed array objects or
8388
* a DataView; false otherwise
89+
* @since 3.0
8490
*/
8591
public static boolean isView(JSValue arg) {
8692
return arg.getContext().property("ArrayBuffer").toObject().property("isView").toFunction()
@@ -93,6 +99,7 @@ public static boolean isView(JSValue arg) {
9399
* @param oldBuffer An ArrayBuffer object from which to transfer from
94100
* @param newByteLength The byte length of the new ArrayBuffer object
95101
* @return a new ArrayBuffer
102+
* @since 3.0
96103
*/
97104
public static JSArrayBuffer transfer(JSArrayBuffer oldBuffer, int newByteLength) {
98105
return new JSArrayBuffer(oldBuffer.getJSObject().getContext().property("ArrayBuffer").toObject()
@@ -103,6 +110,7 @@ public static JSArrayBuffer transfer(JSArrayBuffer oldBuffer, int newByteLength)
103110
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/transfer
104111
* @param oldBuffer An ArrayBuffer object from which to transfer from
105112
* @return a new ArrayBuffer
113+
* @since 3.0
106114
*/
107115
public static JSArrayBuffer transfer(JSArrayBuffer oldBuffer) {
108116
return new JSArrayBuffer(oldBuffer.getJSObject().getContext().property("ArrayBuffer").toObject()
@@ -115,6 +123,7 @@ public static JSArrayBuffer transfer(JSArrayBuffer oldBuffer) {
115123
* @param begin Zero-based byte index at which to begin slicing
116124
* @param end Byte index to end slicing
117125
* @return new ArrayBuffer with sliced contents copied
126+
* @since 3.0
118127
*/
119128
public JSArrayBuffer slice(int begin, int end) {
120129
return new JSArrayBuffer(
@@ -125,6 +134,7 @@ public JSArrayBuffer slice(int begin, int end) {
125134
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/slice
126135
* @param begin Zero-based byte index at which to begin slicing
127136
* @return new ArrayBuffer with sliced contents copied
137+
* @since 3.0
128138
*/
129139
public JSArrayBuffer slice(int begin) {
130140
return new JSArrayBuffer(

AndroidJSCore/AndroidJSCore/src/main/java/org/liquidplayer/webkit/javascriptcore/JSContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void run() {
5959
}
6060
});
6161

62-
public void sync(Runnable runnable) {
62+
protected void sync(Runnable runnable) {
6363
mWorker.sync(runnable);
6464
}
6565
protected void async(Runnable runnable) {

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Design Goals
1919

2020
Version
2121
-------
22-
[3.0-pre1](https://github.com/ericwlange/AndroidJSCore/releases/tag/3.0-pre1) - Please help test this version
22+
[3.0-pre2](https://github.com/ericwlange/AndroidJSCore/releases/tag/3.0-pre2) - Please help test this version
2323

2424
Note there are some significant changes between 3.0 and the 2.x series. In particular, handling of functions
2525
and constructors is simpler (and more correct).
@@ -102,7 +102,7 @@ just about everything.
102102

103103
Use AndroidJSCore in your project
104104
---------------------------------
105-
The easy way is to simply download the file `AndroidJSCore-3.0-pre1-release.aar` from
105+
The easy way is to simply download the file `AndroidJSCore-3.0-pre2-release.aar` from
106106
the [latest release] and drop it somewhere in your project (`libs/` is meant just for this). Then
107107
add the following to your app-level `build.gradle`:
108108

@@ -113,7 +113,7 @@ add the following to your app-level `build.gradle`:
113113
}
114114

115115
dependencies {
116-
compile(name:'AndroidJSCore-3.0-pre1-release', ext:'aar')
116+
compile(name:'AndroidJSCore-3.0-pre2-release', ext:'aar')
117117
}
118118

119119
Building the AndroidJSCoreExample app
@@ -125,7 +125,7 @@ If you want to see AndroidJSCore in action, you can run the example app:
125125
cd ~/AndroidJSCore
126126
mkdir ~/AndroidJSCore/lib
127127

128-
Then download `AndroidJSCore-3.0-pre1-release.aar` from the [latest release] and
128+
Then download `AndroidJSCore-3.0-pre2-release.aar` from the [latest release] and
129129
copy it into `~/AndroidJSCore/lib`. Now you can open `~/AndroidJSCore/examples/AndroidJSCoreExample`
130130
in Android Studio and run it.
131131

@@ -161,7 +161,7 @@ and then re-run `hemroid install javascriptcore`.
161161
% echo sdk.dir=$ANDROID_SDK >> local.properties
162162
% ./gradlew assembleRelease
163163

164-
Your library now sits in `AndroidJSCore/build/outputs/aar/AndroidJSCore-3.0-pre1-release.aar`. To use it, simply
164+
Your library now sits in `AndroidJSCore/build/outputs/aar/AndroidJSCore-3.0-pre2-release.aar`. To use it, simply
165165
add the following to your app's `build.gradle`:
166166

167167
repositories {

examples/AndroidJSCoreExample/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ android {
55
buildToolsVersion "23.0.2"
66
defaultConfig {
77
applicationId "org.liquidplayer.androidjscoreexample"
8-
minSdkVersion 9
8+
minSdkVersion 11
99
targetSdkVersion 23
1010
versionCode 1
1111
versionName "1.0"
@@ -27,7 +27,7 @@ repositories {
2727
}
2828

2929
dependencies {
30-
compile(name:'AndroidJSCore-3.0-pre1-release', ext:'aar')
30+
compile(name:'AndroidJSCore-3.0-pre2-release', ext:'aar')
3131
}
3232

3333
dependencies {

0 commit comments

Comments
 (0)