diff --git a/lib/6to5/file.js b/lib/6to5/file.js index 9f73eae828..e9d5d3dd7c 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -37,12 +37,22 @@ File.helpers = [ "typeof", "exports-wildcard", "extends", - "get" + "get", + "observe-delete", + "observe-get", + "observe-update", + "observe-notify", + "observe-create" ]; File.excludeHelpersFromRuntime = [ "async-to-generator", - "typeof" + "typeof", + "observe-delete", + "observe-get", + "observe-update", + "observe-notify", + "observe-create" ]; File.normaliseOptions = function (opts) { diff --git a/lib/6to5/transformation/templates/observe-create.js b/lib/6to5/transformation/templates/observe-create.js new file mode 100644 index 0000000000..380d05459b --- /dev/null +++ b/lib/6to5/transformation/templates/observe-create.js @@ -0,0 +1,4 @@ +(function (obj, callback) { + global._6to5Obsevers = global._6to5Obsevers || []; + global._6to5Obsevers.push([obj, callback]); +}); diff --git a/lib/6to5/transformation/templates/observe-delete.js b/lib/6to5/transformation/templates/observe-delete.js new file mode 100644 index 0000000000..8d0f4afe7c --- /dev/null +++ b/lib/6to5/transformation/templates/observe-delete.js @@ -0,0 +1,3 @@ +(function () { + +}) diff --git a/lib/6to5/transformation/templates/observe-get.js b/lib/6to5/transformation/templates/observe-get.js new file mode 100644 index 0000000000..8d0f4afe7c --- /dev/null +++ b/lib/6to5/transformation/templates/observe-get.js @@ -0,0 +1,3 @@ +(function () { + +}) diff --git a/lib/6to5/transformation/templates/observe-notify.js b/lib/6to5/transformation/templates/observe-notify.js new file mode 100644 index 0000000000..8d0f4afe7c --- /dev/null +++ b/lib/6to5/transformation/templates/observe-notify.js @@ -0,0 +1,3 @@ +(function () { + +}) diff --git a/lib/6to5/transformation/templates/observe-update.js b/lib/6to5/transformation/templates/observe-update.js new file mode 100644 index 0000000000..8d0f4afe7c --- /dev/null +++ b/lib/6to5/transformation/templates/observe-update.js @@ -0,0 +1,3 @@ +(function () { + +}) diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index 6c118e03a9..4ce66d8203 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -80,6 +80,7 @@ _.each({ generators: require("./transformers/es6-generators"), restParameters: require("./transformers/es6-rest-parameters"), + objectObserve: require("./transformers/optional-object-observe"), protoToAssign: require("./transformers/optional-proto-to-assign"), _declarations: require("./transformers/_declarations"), diff --git a/lib/6to5/transformation/transformers/optional-object-observe.js b/lib/6to5/transformation/transformers/optional-object-observe.js new file mode 100644 index 0000000000..4668b0bf8f --- /dev/null +++ b/lib/6to5/transformation/transformers/optional-object-observe.js @@ -0,0 +1 @@ +exports.optional = true; diff --git a/test/fixtures/transformation/optional-object-observe/options.json b/test/fixtures/transformation/optional-object-observe/options.json new file mode 100644 index 0000000000..4ca12d931b --- /dev/null +++ b/test/fixtures/transformation/optional-object-observe/options.json @@ -0,0 +1,3 @@ +{ + "optional": ["objectObserve"] +}