Skip to content

Loading…

Fix for working in web workers. #5

Merged
merged 1 commit into from

2 participants

@clockworkgeek

The global context in web workers is not "window" since that is only for pages with DOM. "self" is the global context for both.

@vjeux vjeux merged commit dd604ab into jDataView:master
@vjeux
jDataView member

Thanks!

@divergentdave divergentdave added a commit to divergentdave/jsDataView that referenced this pull request
@divergentdave divergentdave Squashed commit of the following:
commit 3377187ea5fa666849ebb1ea74533100913736cb
Merge: 7d112dd 9f6902b
Author: David Cook <divergentdave@gmail.com>
Date:   Thu Dec 1 00:28:48 2011 -0600

    Merge remote-tracking branch 'vjeux/master' into merging_11_30_11

    Add test suite, change character/string handling

    Conflicts:
    	src/jdataview.js

commit 7d112ddea538c0f4160f1e9d987cfe97ef4e0352
Merge: b1ec995 0309f71
Author: David Cook <divergentdave@gmail.com>
Date:   Thu Dec 1 00:21:03 2011 -0600

    Merge and fix ArrayBuffer offset changes

    _getUint8() should still read Uint8Array(this.buffer, this._start +
    byteOffset, 1)[0]

    Merge commit '0309f71' into merging_11_30_11

    Conflicts:
    	src/jdataview.js

commit b1ec995cbee7e2c847e2aada044bd30e1ad7d982
Merge: 88db5dc 3dca47c
Author: David Cook <divergentdave@gmail.com>
Date:   Thu Dec 1 00:03:29 2011 -0600

    Merge commit '3dca47' into merging_11_30_11

    Initial NodeJS Buffer Support

    Conflicts:
    	src/jdataview.js

commit 88db5dcd1d851da3833679fff64002843e601ab6
Merge: 71165e3 096fc1e
Author: David Cook <divergentdave@gmail.com>
Date:   Wed Nov 30 23:55:14 2011 -0600

    Merge commit '096f' into merging_11_30_11

    Added buffer, byteLength and byteOffset attributes

    Conflicts:
    	src/jdataview.js

commit 71165e391764afb47163e47803a68e682e78d958
Merge: 37d7957 c98e77b
Author: David Cook <divergentdave@gmail.com>
Date:   Wed Nov 30 21:31:02 2011 -0600

    Merge commit 'c98e77' into merging_11_30_11

    Many changes, original comment was "merges"

    Conflicts:
    	src/jdataview.js

commit 37d7957e20881eade885085f5cfbefb046f1c49b
Merge: 203e1a1 9c30432
Author: David Cook <divergentdave@gmail.com>
Date:   Wed Nov 30 21:21:12 2011 -0600

    Merge commit '9c304' into merging_11_30_11

    Removed jsHint warnings

    Conflicts:
    	src/jdataview.js

commit 203e1a1170b5ab9fadd9698b2cac741993881c72
Author: David Cook <divergentdave@gmail.com>
Date:   Wed Nov 30 21:09:49 2011 -0600

    Fix tab error first

commit 9f6902b
Author: Christopher Chedeau <vjeuxx@gmail.com>
Date:   Wed Nov 30 17:07:17 2011 +0100

    Update README.md

commit e9644cf
Merge: 870444a b67f1bb
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 16:52:44 2011 +0100

    Merge branch 'master' of github.com:vjeux/jDataView

commit 870444a
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 16:52:35 2011 +0100

    getChar uses getString(1). getChar now respects basic ascii

commit b67f1bb
Author: Christopher Chedeau <vjeuxx@gmail.com>
Date:   Wed Nov 30 16:14:41 2011 +0100

    Update README.md

commit e73f002
Merge: d78ff73 a6731c0
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 16:07:36 2011 +0100

    Merge branch 'master' of github.com:vjeux/jDataView

commit d78ff73
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 16:07:21 2011 +0100

    getString: Removed support for extended ascii to follow nodeJS Buffer specification

commit 0781fda
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 16:06:20 2011 +0100

    Addition of a test suite

commit a6731c0
Author: Christopher Chedeau <vjeuxx@gmail.com>
Date:   Wed Nov 30 15:18:25 2011 +0100

    Update README.md

commit 0309f71
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 15:13:54 2011 +0100

    Improved many checks and fixed bugs when constructor byteOffset != 0. Thanks to @divergentdave

commit 00eae1a
Merge: 3dca47c cbf0e85
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 14:43:12 2011 +0100

    Merge branch 'master' of github.com:vjeux/jDataView

commit 3dca47c
Author: Vjeux <vjeuxx@gmail.com>
Date:   Wed Nov 30 12:09:29 2011 +0100

    Initial NodeJS Buffer Support

commit cbf0e85
Author: Christopher Chedeau <vjeuxx@gmail.com>
Date:   Tue Nov 29 21:54:53 2011 +0100

    Update README.md

commit 84b6b62
Author: Christopher Chedeau <vjeuxx@gmail.com>
Date:   Tue Nov 29 21:23:49 2011 +0100

    Update README.md

commit 096fc1e
Author: Vjeux <vjeuxx@gmail.com>
Date:   Tue Nov 29 21:19:17 2011 +0100

    Added buffer, byteLength and byteOffset attributes as written in the DataView specifications

commit c98e77b
Merge: 9c30432 dd604ab
Author: Vjeux <vjeuxx@gmail.com>
Date:   Fri Nov 25 19:02:53 2011 +0100

    merges

commit 9c30432
Author: Vjeux <vjeuxx@gmail.com>
Date:   Fri Nov 25 18:52:24 2011 +0100

    Removed jsHint warnings

commit dd604ab
Merge: d9249da 129c86c
Author: Christopher Chedeau <vjeuxx@gmail.com>
Date:   Thu Oct 20 08:16:24 2011 -0700

    Merge pull request #5 from clockworkgeek/master

    Fix for working in web workers. window -> self

commit 129c86c
Author: Daniel <daniel@clockworkgeek.com>
Date:   Wed Oct 19 21:18:53 2011 +0100

    Fix for working in web workers.
b5a2ac4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 19, 2011
  1. @clockworkgeek
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/jdataview.js
View
4 src/jdataview.js
@@ -296,7 +296,7 @@ for (var type in dataTypes) {
// ArrayBuffer: we use a typed array of size 1 if the alignment is good
// ArrayBuffer does not support endianess flag (for size > 1)
else if (this._isArrayBuffer && byteOffset % size == 0 && (size == 1 || littleEndian)) {
- value = new window[type + 'Array'](this._buffer, byteOffset, 1)[0];
+ value = new self[type + 'Array'](this._buffer, byteOffset, 1)[0];
}
else {
// Error Checking
@@ -317,6 +317,6 @@ for (var type in dataTypes) {
})(type);
}
-window.jDataView = jDataView;
+self.jDataView = jDataView;
})();
Something went wrong with that request. Please try again.