Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/typedObjects.js

Issue 6273062181797888: Issue 505 - [Typed objects] Implement array helper methods (Closed)
Patch Set: Created May 17, 2014, 9:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/typedObjects/arrayTypes.js » ('j') | lib/typedObjects/arrayTypes.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 * garbage collected. In addition, it has the following properties and methods: 148 * garbage collected. In addition, it has the following properties and methods:
149 * 149 *
150 * get(index): retrieves the array element at specified index. 150 * get(index): retrieves the array element at specified index.
151 * set(index, value): sets the array element at specified index. 151 * set(index, value): sets the array element at specified index.
152 * length: number of elements in the array, by default 0. Increase the length 152 * length: number of elements in the array, by default 0. Increase the length
153 * to match your data size. 153 * to match your data size.
154 * size: size of the allocated buffer in array elements, will be at least 154 * size: size of the allocated buffer in array elements, will be at least
155 * equal to length. Normally you won't need to set the size explicitly. 155 * equal to length. Normally you won't need to set the size explicitly.
156 * However, the size won't decrease automatically if the array gets 156 * However, the size won't decrease automatically if the array gets
157 * smaller so you might want to set it in order to shrink the array. 157 * smaller so you might want to set it in order to shrink the array.
158 * splice(), push(), pop(), unshift(), shift(): these work the same as the
159 * corresponding methods on JavaScript's Array class. Note however that
160 * using pop() and shift() with arrays of objects is dangerous if you
161 * want to work with their return value: this operation will call
162 * release() on the resulting object before returning which might result
163 * in it being garbage collected. You should call retain() on the array
164 * element before calling pop() or shift().
158 * 165 *
159 * String type 166 * String type
160 * ----------- 167 * -----------
161 * 168 *
162 * There is a special array type called string: 169 * There is a special array type called string:
163 * 170 *
164 * var str1 = string(); // empty string 171 * var str1 = string(); // empty string
165 * var str2 = string(2); // "\0\0" 172 * var str2 = string(2); // "\0\0"
166 * var str3 = string("foo"); // "foo" 173 * var str3 = string("foo"); // "foo"
167 * var str4 = string(str3, 1, 2); // "oo" 174 * var str4 = string(str3, 1, 2); // "oo"
(...skipping 12 matching lines...) Expand all
180 function forwardExports(module) 187 function forwardExports(module)
181 { 188 {
182 let moduleExports = require(module); 189 let moduleExports = require(module);
183 for (let key in moduleExports) 190 for (let key in moduleExports)
184 exports[key] = moduleExports[key]; 191 exports[key] = moduleExports[key];
185 } 192 }
186 193
187 forwardExports("typedObjects/primitiveTypes"); 194 forwardExports("typedObjects/primitiveTypes");
188 forwardExports("typedObjects/objectTypes"); 195 forwardExports("typedObjects/objectTypes");
189 forwardExports("typedObjects/stringType"); 196 forwardExports("typedObjects/stringType");
OLDNEW
« no previous file with comments | « no previous file | lib/typedObjects/arrayTypes.js » ('j') | lib/typedObjects/arrayTypes.js » ('J')

Powered by Google App Engine
This is Rietveld