Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate

Issue 11510013: Making ScriptProcessorNode not an EventTarget. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/templates/html/dart2js/web_audio_dart2js.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate b/tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate
new file mode 100644
index 0000000000000000000000000000000000000000..52ba80f348c4b834bd161c3cfda345898bdbb1c3
--- /dev/null
+++ b/tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate
@@ -0,0 +1,41 @@
+// Copyright (c) 2013, 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.
+
+part of $LIBRARY;
+
+$(ANNOTATIONS)class $CLASSNAME$EXTENDS$NATIVESPEC {
+ Stream<AudioProcessingEvent> _eventStream;
+
+ /**
+ * Get a Stream that fires events when AudioProcessingEvents occur.
+ * This particular stream is special in that it only allows one listener to a
+ * given stream. Converting the returned Stream [asBroadcast] will likely ruin
+ * the soft-real-time properties which which these events are fired and can
+ * be processed.
+ */
+ Stream<AudioProcessingEvent> get onAudioProcess {
+ if (_eventStream == null) {
+ var controller = new StreamController();
+ var callback = (audioData) {
+ if (controller.hasSubscribers) {
+ // This stream is a strange combination of broadcast and single
+ // subscriber streams. We only allow one listener, but if there is
+ // no listener, we don't queue up events, we just drop them on the
+ // floor.
+ controller.add(audioData);
+ }
+ };
+$if DART2JS
+ JS('void', '#.onaudioprocess = #', this,
+ convertDartClosureToJS(callback, 1));
+$else
+ // TODO(podivilov): Implement on Dartium.
+$endif
+
+ _eventStream = controller.stream;
+ }
+ return _eventStream;
+ }
+$!MEMBERS
+}
« no previous file with comments | « tools/dom/templates/html/dart2js/web_audio_dart2js.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698