SteveSanderson/knockout.mapping — Issue #57: AMD/RequireJS support
Author: sgentile
Created: 2012-02-16 12:01:11+00:00
State: open

The lastest branch of Knockout supports AMD/RequireJs. While converting your code to also use AMD/RequireJS ran into some issues. The knockout.mapping has the following function in it:

ko.exportSymbol = function (publicPath, object) {
var tokens = publicPath.split(".");
var target = window;
for (var i = 0; i < tokens.length - 1; i++)
target = target[tokens[i]];
target[tokens[tokens.length - 1]] = object;
};

and it uses the var target = window as the start. knockout.js has a
similar function, but it uses target = ko as the start.

I'd like to ask for that change, and
that way the ko.exportSymbol() usage at the bottom of the file can be
reduced. It is unclear though that any of that export symbol stuff is
needed at all in the mapping file since it starts at the top of the
file and does a ko.mapping = {} anyway.