OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 class _IDBKeyRangeFactoryProvider { |
| 6 |
| 7 factory IDBKeyRange.only(/*IDBKey*/ value) => |
| 8 _only(_class(), _translateKey(value)); |
| 9 |
| 10 factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open = false]) => |
| 11 _lowerBound(_class(), _translateKey(bound), open); |
| 12 |
| 13 factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open = false]) => |
| 14 _upperBound(_class(), _translateKey(bound), open); |
| 15 |
| 16 factory IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper, |
| 17 [bool lowerOpen = false, bool upperOpen = false]) => |
| 18 _bound(_class(), _translateKey(lower), _translateKey(upper), |
| 19 lowerOpen, upperOpen); |
| 20 |
| 21 static var _cachedClass; |
| 22 |
| 23 static _class() { |
| 24 if (_cachedClass != null) return _cachedClass; |
| 25 return _cachedClass = _uncachedClass(); |
| 26 } |
| 27 |
| 28 static _uncachedClass() native ''' |
| 29 return window.webkitIDBKeyRange || window.mozIDBKeyRange || |
| 30 window.msIDBKeyRange || window.IDBKeyRange; |
| 31 '''; |
| 32 |
| 33 static _translateKey(idbkey) => idbkey; // TODO: fixme. |
| 34 |
| 35 static _IDBKeyRangeJs _only(cls, value) native |
| 36 '''return cls.only(value);'''; |
| 37 |
| 38 static _IDBKeyRangeJs _lowerBound(cls, bound, open) native |
| 39 '''return cls.lowerBound(bound, open);'''; |
| 40 |
| 41 static _IDBKeyRangeJs _upperBound(cls, bound, open) native |
| 42 '''return cls.upperBound(bound, open);'''; |
| 43 |
| 44 static _IDBKeyRangeJs _bound(cls, lower, upper, lowerOpen, upperOpen) native |
| 45 '''return cls.bound(lower, upper, lowerOpen, upperOpen);'''; |
| 46 |
| 47 } |
OLD | NEW |