| 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 part of html; | |
| 6 | |
| 7 class _IDBKeyRangeFactoryProvider { | |
| 8 | |
| 9 static IDBKeyRange createIDBKeyRange_only(/*IDBKey*/ value) => | |
| 10 _only(_class(), _translateKey(value)); | |
| 11 | |
| 12 static IDBKeyRange createIDBKeyRange_lowerBound( | |
| 13 /*IDBKey*/ bound, [bool open = false]) => | |
| 14 _lowerBound(_class(), _translateKey(bound), open); | |
| 15 | |
| 16 static IDBKeyRange createIDBKeyRange_upperBound( | |
| 17 /*IDBKey*/ bound, [bool open = false]) => | |
| 18 _upperBound(_class(), _translateKey(bound), open); | |
| 19 | |
| 20 static IDBKeyRange createIDBKeyRange_bound(/*IDBKey*/ lower, /*IDBKey*/ upper, | |
| 21 [bool lowerOpen = false, bool upperOpen = false]) => | |
| 22 _bound(_class(), _translateKey(lower), _translateKey(upper), | |
| 23 lowerOpen, upperOpen); | |
| 24 | |
| 25 static var _cachedClass; | |
| 26 | |
| 27 static _class() { | |
| 28 if (_cachedClass != null) return _cachedClass; | |
| 29 return _cachedClass = _uncachedClass(); | |
| 30 } | |
| 31 | |
| 32 static _uncachedClass() => | |
| 33 JS('var', | |
| 34 '''window.webkitIDBKeyRange || window.mozIDBKeyRange || | |
| 35 window.msIDBKeyRange || window.IDBKeyRange'''); | |
| 36 | |
| 37 static _translateKey(idbkey) => idbkey; // TODO: fixme. | |
| 38 | |
| 39 static IDBKeyRange _only(cls, value) => | |
| 40 JS('IDBKeyRange', '#.only(#)', cls, value); | |
| 41 | |
| 42 static IDBKeyRange _lowerBound(cls, bound, open) => | |
| 43 JS('IDBKeyRange', '#.lowerBound(#, #)', cls, bound, open); | |
| 44 | |
| 45 static IDBKeyRange _upperBound(cls, bound, open) => | |
| 46 JS('IDBKeyRange', '#.upperBound(#, #)', cls, bound, open); | |
| 47 | |
| 48 static IDBKeyRange _bound(cls, lower, upper, lowerOpen, upperOpen) => | |
| 49 JS('IDBKeyRange', '#.bound(#, #, #, #)', | |
| 50 cls, lower, upper, lowerOpen, upperOpen); | |
| 51 } | |
| OLD | NEW |