unsubscribe_ method

dynamic unsubscribe_(
  1. dynamic path
)

Implementation

unsubscribe_(path) {
  // tells the group to forget about a property path and no longer
  // update the array previously obtained with 'subscribe_'

  var indicesByPath = _bindingsIndicesByPath,
      index = indicesByPath[path];

  if (index != null) {
    var paths = _paths,
        parsedPaths = _parsedPaths,
        bindings = _bindings,
        lastBindingsIndex = bindings.length - 1,
        lastBindings = bindings[lastBindingsIndex],
        lastBindingsPath = path[lastBindingsIndex];

    indicesByPath[lastBindingsPath] = index;

    bindings[index] = lastBindings;
    bindings.pop();

    parsedPaths[index] = parsedPaths[lastBindingsIndex];
    parsedPaths.pop();

    paths[index] = paths[lastBindingsIndex];
    paths.pop();
  }
}