Skip to content

Refactored Properties using Object.defineProperties #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2017

Conversation

tmulkern
Copy link
Contributor

@tmulkern tmulkern commented Sep 7, 2017

Refactored Properties using Object.defineProperties as seen here

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

This reduces the javascript code by removing repeated code. This will
have an impact on overall file size.

Signed-off-by: Tadhg Mulkern[email protected]

Refactored Properties using Object.defineProperties as seen here

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

This reduces the javascript code by removing repeated code. This will
have a impact on overall file size.

Signed-off-by: Tadhg Mulkern<[email protected]>
@tmulkern
Copy link
Contributor Author

tmulkern commented Sep 7, 2017

Size before changes

[INFO] Uncompressed size: 91402 bytes.
[INFO] Compressed size: 33401 bytes minified (8429 bytes gzipped).

https://travis-ci.org/eclipse/paho.mqtt.javascript/builds/272407632#L765

Size after changes

[INFO] Uncompressed size: 89225 bytes.
[INFO] Compressed size: 31502 bytes minified (8078 bytes gzipped).

https://travis-ci.org/eclipse/paho.mqtt.javascript/builds/273000617#L773

That's a saving of 2% Uncompressed, 6% Compressed and 4% gzipped

@jpwsutton jpwsutton self-assigned this Sep 8, 2017
@jpwsutton
Copy link
Contributor

Thanks @tmulkern, nice improvement!

@jpwsutton jpwsutton merged commit 3c07549 into eclipse-paho:develop Sep 8, 2017
@tmulkern tmulkern deleted the refactor-public-properties branch September 8, 2017 11:40
jpwsutton added a commit that referenced this pull request Jul 23, 2018
* Removed reference to window and change to self (#116)

* Removed reference to window and change to self

Removed reference to window and change to self. This is to allow the
client to be used in Web Workers see:
https://developer.mozilla.org/en/docs/Web/API/Window/self

Signed-off-by: Tadhg Mulkern<[email protected]>

* Updated Client-hareness.js

Updated Client-hareness.js, set global.window = global; to global.self =
global;

* Update .travis.yml to fix build error

Update .travis.yml to fix build error, set nodejs version to use the
latest stable version of 5.x

* Refactored Properties using Object.defineProperties (#120)

* Refactored Properties using Object.defineProperties

Refactored Properties using Object.defineProperties as seen here

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

This reduces the javascript code by removing repeated code. This will
have a impact on overall file size.

Signed-off-by: Tadhg Mulkern<[email protected]>

* Added additional cleanup of code

Added a piece of code to removed the need for all the Typed Array
checks, base on this method

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView
and from the Stackoverflow answer
https://stackoverflow.com/questions/15251879/how-to-check-if-a-variable-is-a-typed-array-in-javascript/29651223#29651223

* Remove the needed for reversing arrays for processing

Changed usages of push on this._buffered_msg_queue and this._msg_queue
to use unshift

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift,
removing the need to reverse the array to pop elements in fifo order

Signed-off-by: Tadhg Mulkern<[email protected]>

* Tweaking tests to run on travis.

Signed-off-by: James Sutton <[email protected]>

* Fix typo (#128)

Signed-off-by: Nico Rikken <[email protected]>

* Moving to eslint and setting consistent code style in paho-mqtt.js as well as improving build

Signed-off-by: James Sutton <[email protected]>

* Fixing tests to fully complete

Signed-off-by: James Sutton <[email protected]>

* Variable message should not be global

Signed-off-by: Jannik Hunziker <[email protected]>

* Function call should be local

Signed-off-by: Jannik Hunziker <[email protected]>

* Variable client should not be global

Signed-off-by: Jannik Hunziker <[email protected]>

* Variable client should not be global

Signed-off-by: Jannik Hunziker <[email protected]>

* Updating Utility to use Automatic Reconnect & have visible console

Signed-off-by: James Sutton <[email protected]>

* Fixing tests to work with updated interopability broker, updating .gitignore and readme.

Signed-off-by: James Sutton <[email protected]>

* Adding Travis badge and fixing typo.

Signed-off-by: James Sutton <[email protected]>

* Added subscribe/unsunbscribe support for multiple topics

Signed-off-by: Michael Zak <[email protected]>

* Fixing typo in PR and adding a test case

Signed-off-by: James Sutton <[email protected]>

* GDPR - Adding LocalStorage Warning to Utility

Signed-off-by: James Sutton <[email protected]>

* Brings Paho one step closer to be supported in non-browser environments. (#153)

* Fix global object

Signed-off-by: Manuel Iglesias <[email protected]>

* Remove references to self

Signed-off-by: Manuel Iglesias <[email protected]>

* Fix arguments conversion to array

Signed-off-by: Manuel Iglesias <[email protected]>

* Use simple in-memory fake of localStorage when global one is not available

Signed-off-by: Manuel Iglesias <[email protected]>

* Updating version to 1.1.0 for Eclipse Photon

Signed-off-by: James Sutton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants