Skip to content

Commit

Permalink
Minor changes; references to Array.observe polyfill
Browse files Browse the repository at this point in the history
Removed unused code from benchmarks
Fixed benchmark page titles
Fixed benchmark script definitions in package.json
Tweaked checks for undefined values
Added references to Array.observe polyfill
  • Loading branch information
MaxArt2501 committed Aug 24, 2015
1 parent 032da54 commit 3418773
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 68 deletions.
2 changes: 0 additions & 2 deletions benchmark/benchmarks-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ root.generateObject = function(numberOfProperties) {
return object;
}

function noop() {}

var padspace = (new Array(81)).join(" ");
function padL(text, length) {
return (padspace + text).slice(-length);
Expand Down
2 changes: 0 additions & 2 deletions benchmark/benchmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ root.generateObject = function(numberOfProperties) {
return object;
}

function noop() {}

var padspace = (new Array(81)).join(" ");
function padL(text, length) {
return (padspace + text).slice(-length);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/index-lite.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Object.observe polyfill tests</title>
<title>Object.observe polyfill benchmarks</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Object.observe polyfill tests</title>
<title>Object.observe polyfill benchmarks</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
Expand Down
19 changes: 10 additions & 9 deletions dist/object-observe-lite.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*!
* Object.observe "lite" polyfill - v0.2.4
* by Massimo Artizzu (MaxArt2501)
*
*
* https://github.com/MaxArt2501/object-observe
*
*
* Licensed under the MIT License
* See LICENSE for details
*/
Expand Down Expand Up @@ -58,7 +58,7 @@
* @returns {ChangeRecord|undefined}
*/

Object.observe || (function(O, A, root) {
Object.observe || (function(O, A, root, _undefined) {
"use strict";

/**
Expand Down Expand Up @@ -110,7 +110,7 @@ Object.observe || (function(O, A, root) {
* @function createMap
* @returns {Map}
*/
createMap = typeof root.Map === "undefined" || !Map.prototype.forEach ? function() {
createMap = root.Map === _undefined || !Map.prototype.forEach ? function() {
// Lightweight shim of Map. Lacks clear(), entries(), keys() and
// values() (the last 3 not supported by IE11, so can't use them),
// it doesn't handle the constructor's argument (like IE11) and of
Expand Down Expand Up @@ -232,7 +232,7 @@ Object.observe || (function(O, A, root) {
else {
data = createObjectData(object);
setHandler(object, data, handler, acceptList);

if (observed.size === 1)
// Let the observation begin!
nextFrame(runGlobalLoop);
Expand Down Expand Up @@ -300,7 +300,7 @@ Object.observe || (function(O, A, root) {
ovalue = values[idx];
props[idx] = null;
proplen--;
if (ovalue === value ? ovalue === 0 && 1/ovalue !== 1/value
if (ovalue === value ? ovalue === 0 && 1/ovalue !== 1/value
: ovalue === ovalue || value === value) {
addChangeRecord(object, data, {
name: key,
Expand Down Expand Up @@ -405,7 +405,8 @@ Object.observe || (function(O, A, root) {
// If there's no data, the object has been unobserved
var data = observed.get(object),
prop, changeRecord,
result = func.call(arguments[2]);
thisObj = arguments[2],
result = thisObj === _undefined ? func() : func.call(thisObj);

data && performPropertyChecks(data, object, changeType);

Expand Down Expand Up @@ -487,7 +488,7 @@ Object.observe || (function(O, A, root) {
if (O.isFrozen && O.isFrozen(handler))
throw new TypeError("Object.observe cannot deliver to a frozen function object");

if (typeof acceptList === "undefined")
if (acceptList === _undefined)
acceptList = defaultAcceptList;
else if (!acceptList || typeof acceptList !== "object")
throw new TypeError("Third argument to Object.observe must be an array of strings.");
Expand Down Expand Up @@ -572,4 +573,4 @@ Object.observe || (function(O, A, root) {
}
};

})(Object, Array, this);
})(Object, Array, this);
2 changes: 1 addition & 1 deletion dist/object-observe-lite.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3418773

Please sign in to comment.