blob: 83ff8c9d7c214250dde4f21280d89a39ba1dd018 [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class $FACTORYPROVIDER {
static $CONSTRUCTOR create$(CONSTRUCTOR)(MutationCallback callback) native '''
var constructor =
window.MutationObserver || window.WebKitMutationObserver ||
window.MozMutationObserver;
return new constructor(callback);
''';
// TODO(sra): Dart2js inserts a conversion when a Dart function (i.e. an
// object with a call method) is passed to a native method. This is so the
// native code sees a JavaScript function.
//
// This does not happen when a function is 'passed' to a JS-form so it is not
// possible to rewrite the above code to, e.g. (simplified):
//
// static createMutationObserver(MutationCallback callback) =>
// JS('var', 'new (window.MutationObserver)(#)', callback);
}