| 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 $FACTORYPROVIDER { | |
| 6 factory Blob(List blobParts = null, [String type, String endings]) { | |
| 7 // TODO: validate that blobParts is a JS Array and convert if not. | |
| 8 // TODO: any coercions on the elements of blobParts, e.g. coerce a typed | |
| 9 // array to ArrayBuffer if it is a total view. | |
| 10 if (type == null && endings == null) { | |
| 11 return _create_1(blobParts); | |
| 12 } | |
| 13 var bag = _create_bag(); | |
| 14 if (type != null) _bag_set(bag, 'type', type); | |
| 15 if (endings != null) _bag_set(bag, 'endings', endings); | |
| 16 return _create_2(blobParts, bag); | |
| 17 } | |
| 18 | |
| 19 static _create_1(parts) native 'return new Blob(parts);'; | |
| 20 static _create_2(parts, bag) native 'return new Blob(parts, bag);'; | |
| 21 | |
| 22 static _create_bag() native 'return {}'; | |
| 23 static _bag_set(bag, key, value) native 'bag[key] = value;'; | |
| 24 } | |
| OLD | NEW |