summaryrefslogtreecommitdiff
path: root/js
AgeCommit message (Collapse)AuthorFilesLines
2020-10-19[JS/TS] Rewrite flexbuffers JS to TS (#6148)Björn Harrtell1-1048/+0
* Partial TS rewrite * Completed port but bugs remain * Expose builder function * Break out and fix stack-value and formatting
2020-09-17[JS/TS] Modernize TypeScript / JavaScript flatbuffers support (#6095)Björn Harrtell2-1398/+1
2020-09-10[JS] FlexBuffers Fix for wrong type of offset and length values (#6107)Maxim Zaks1-25/+34
* Adding FlexBuffers support for Dart language * Introduce snapshot method. * Fix docu * Replacing extension methods with static methods in order to support older Dart version * Improving code based on PR feedback. Mainly rename refactoring. * Addressing all PR feedback which does not need clarification * exchange dynamic type with Object * Adds better API documentation. [] operator throws a very descriptive exception in case of a bad key. * Implementation of JavaScript FlexBuffers decoder * implements JS FlexBuffers builder * replacing _toF32 with Math.fround * Introducing test for BigInt number * Moving functions from BitWitdth & ValueType object into BitWidthUtil and ValueTypeUtil accordingly. Removing defensive checks. Introducing fix for large int numbers by converting them to BigInt type. Introducing handling for BigInt type in `add` method. Using TextEncoder and Decoder to handle string / utf8 conversion. * rename variable * Lets user turn deduplication strategies for strings, keys and vector of keys off while building FlexBuffer. Implements quick sort and choses quick sort if the number of keys is bigger then 20. Removes unnecessary dict lookups in BitWidthUtil helper functions * make iwidth and uwidth computation simpler and faster * Making redInt and readUint a bit faster and shim the BigInt / BigUint usage * Fixing a bug in FlexBuffers JS, where offsets and lengths are stored and read as int and not as uint values. * Fixing a bug in FlexBuffers Dart, where offset and length values are stored and read as int values instead of uint values
2020-08-31[JS] FlexBuffers Support (#5973)Maxim Zaks1-0/+1039
* Adding FlexBuffers support for Dart language * Introduce snapshot method. * Fix docu * Replacing extension methods with static methods in order to support older Dart version * Improving code based on PR feedback. Mainly rename refactoring. * Addressing all PR feedback which does not need clarification * exchange dynamic type with Object * Adds better API documentation. [] operator throws a very descriptive exception in case of a bad key. * Implementation of JavaScript FlexBuffers decoder * implements JS FlexBuffers builder * replacing _toF32 with Math.fround * Introducing test for BigInt number * Moving functions from BitWitdth & ValueType object into BitWidthUtil and ValueTypeUtil accordingly. Removing defensive checks. Introducing fix for large int numbers by converting them to BigInt type. Introducing handling for BigInt type in `add` method. Using TextEncoder and Decoder to handle string / utf8 conversion. * rename variable * Lets user turn deduplication strategies for strings, keys and vector of keys off while building FlexBuffer. Implements quick sort and choses quick sort if the number of keys is bigger then 20. Removes unnecessary dict lookups in BitWidthUtil helper functions * make iwidth and uwidth computation simpler and faster * Making redInt and readUint a bit faster and shim the BigInt / BigUint usage
2020-07-27[Feature] Checks for Nullable strings (#6050)mustiikhalil1-0/+24
* Allows null strings in createString method c# * Adds nullable strings to JS and swift * Changes js checks * Fixes typo
2020-04-09[TS] Add Obj API (#5788)Khoi Dinh Trinh1-0/+115
* added basic code * backup work * got class property to work * backup progress * implementented fmt for creating code * added docs for genFieldUtils * back up work * added base helper js func * added union js code * added unpackTo and base for pack * added pack code * added null check for packing struct list * passes compile test * fixed some spacing of generated functions * added annotations for constructors * added obj api unpack test * tested pack to work * merge branch * separated js and ts test * fixed union signature to include string * fixed generator to support string union * hardcoded fb builder name * refactored struct vector creation * work around createLong * handle default value in constructor * update typescript docs * added notes about import flag * fixed formatting stuffs * undo TypescriptTest change * refactored fmt * updated generated code * remove ignoring union_vector for js * revert changes for .project * revert changes for package.json * don't generate js in ts test * fixed android project file * removed unused js function * removed package-lock.json * adjust createObjList to new signature * changed regex to callback style * fixed package.json * used existing func for generating annotation * changed ternary to !! * added return type for lambda * removed callback style for obj api generator * fixed js file indentation * removed unused header * added tests for string only union * handle string only union and refactor union conv func * updated generated ts files * renamed union conv func * made js test create files like other languages * removed union string only handling * don't allow null in createObjectOffsetList * updated generated ts code * changed the line that triggers Windows build errors * hopefully fix CI error
2020-03-12Add non-nullable modifier to return type of functions never returning null ↵Jakub Vrána1-10/+10
(#5797)
2019-05-16[JS/TS] Size prefix support (#5326)Björn Harrtell1-3/+24
* WIP size prefix support * Consider size prefix in overloaded variant * Work on code gen * Disabled helper functions in code gen * Enabled helper functions in code gen * Fix size prefixed test * Fix bad function call * Add SIZE_PREFIX_LENGTH * Fix review comments
2019-04-22[Javascript] Remove newly introduced trailing whitespace in flatbuffer.js ↵Damien Lespiau1-2/+1
(#5300) * Remove newly introduced trailing whitespace in flatbuffer.js The newly introduced clear function has some trailing white space in an otherwise whitespace clean file. Remove it. * Remove spurious new line in the BytesBuffer construction Another spurious white space introduced by the clear() PR.
2019-01-14JS- support clear() method on builder (#5109)unintellisense1-0/+18
* support clearing flatBuffer builder in js * remove unused member reset force_defaults dont actually need to clear data in bytebuffer
2018-04-23Adding JS function to get the File Identifier (#4715)Mark Henderson1-0/+20
* Adding JS function to get the File Identifier * Update flatbuffers.js
2017-08-24Trimmed vtables of trailing zeroes.Wouter van Oortmerssen1-6/+11
This is something the format supports, but none of the builders were doing. Can save 10-20% on FlatBuffer binary size! Also fixed the Go tests. Change-Id: I616c56ce9bbcfcaee23aa24f0532fcb60b6a8c75 Tested: on Linux.
2017-04-17Undo PR: make flatbuffers.js into a UMD module (#4228)Wouter van Oortmerssen1-11/+14
This PR did not work in all JS environments and caused downstream breakage. Change-Id: Ib565129e26622d02bad2d45816bd05f6b961b994
2017-04-10TypeScript support (#4232)Kamil Rojewski1-0/+29
* Eclipse ignore * TypeScript support * Prefixing enums * Test results * Merged JS and TS generators * Fixed AppVeyor build problems * Fixed more AppVeyor build problems * Fixed more AppVeyor build problems * Changed TS flag to options struct * Storing options by value * Removed unneeded const * Re-export support for unions * Uint support * Casting bools to numbers for mutation * TS shell tests * Reverted generates js test file to original version * Backing up js tests and properly generating test data
2017-04-07make flatbuffers.js into a UMD module (#4228)Iain van der Bloat1-14/+11
2017-03-27Fixing closure compile compatibility when --gen-mutable is used.Wouter van Oortmerssen1-1/+9
Change-Id: I8bf575ba6dc795d2d2eec02fa8977dcc2594eaa6
2017-02-20fix #4180: Long.prototype.toFloat64() overflow (#4182)litianzhao1-1/+1
2017-02-08Changes to make flatbuffers javascript compatible with the closure compiler.Wouter van Oortmerssen1-0/+13
Change-Id: Iab8d66a8f34910029deb8a5ff5ec7ba50c5b3421
2016-10-21Fix Closure Compiler warnings (#4067)cajun-rat1-12/+15
* Make parameter order in jsdocs match function When the order doesn't match the Google Closure Javascript compiler generates warnings * Prefix optional parameters with opt_ The Closure Compiler emits warnings when this isn't the case
2016-08-10Clarified in the docs how to get to the serialized bytes.Wouter van Oortmerssen1-3/+2
This was a frequent source of confusion, since in all implementations the data doesn't start at offset 0 in the buffer. Change-Id: I045966e65928e9acd9def84e215914ecb5510653
2016-07-11js:add @namespace annotation to namespacesJames Gilles1-0/+4
2016-02-25Fix #3773: Generated JS now avoids the flatbuffers objectEvan Wallace1-0/+32
2016-01-19Revamping the FlatBuffers docs.Mark Klara1-10/+46
Adding an API reference for the supported languages. General docs cleanup, including a new `tutorial` section that supports all of the supported languages. Added samples for each supported language to mirror the new tutorial page. Cleaned up all the links by making them `@ref` style links, instead of referencing the names of the generated `.html` files. Removed all generated files that were unnecessarily committed. Also fixed the C# tests (two were failing due to a missing file). Bug: b/25801305 Tested: Tested all samples on Ubuntu, Mac, and Android. Docs were generated using doxygen and viewed on Chrome. Change-Id: I2acaba6e332a15ae2deff5f26a4a25da7bd2c954
2015-10-14Add UTF-8 support to the JavaScript APIEvan Wallace1-30/+53
This adds an optional argument to generated getters for string fields to specify the encoding type and overloads the createString() function. It's now possible to use either JavaScript UTF-16 string objects or C-style UTF-8 byte arrays (Uint8Array) for string data.
2015-10-14change DataView to bit twiddling for JavaScriptEvan Wallace1-20/+48
2015-10-14Add low-level fuzzer, fix 64-bit issue it foundEvan Wallace1-2/+2
2015-10-14Add support for JavaScript code generationEvan Wallace1-0/+1021
This adds a JavaScript language target. The generated JavaScript uses Google Closure Compiler type annotations and can be compiled using the advanced compilation mode, which performs type checking and optimizations such as inlining and dead code elimination. The generated JavaScript also exports all generated symbols for use with Node.js and RequireJS. This export behavior can be turned off with the --no-js-exports flag for use with Google Closure Compiler.