Event listeners for context menus don't work.
Opened this issue · 2 comments
Deleted user commented
Event listeners for context menus don't work.
Contents of background.dart
import 'package:chrome/chrome_ext.dart' as chrome;
import 'dart:html' as html;
void _contextMenuListener(event) {
html.window.alert(event.toString());
return;
}
// for creating context menu options on screen
void _createContextMenu() {
chrome.contextMenus.removeAll();
var params = new chrome.ContextMenusCreateParams(
type: chrome.ItemType.NORMAL, title: "test", id: "test");
chrome.contextMenus.create(params);
chrome.contextMenus.onClicked.listen(_contextMenuListener);
}
void main() {
_createContextMenu();
}
version: "0.10.1"
Dart SDK version: Dart VM version: 2.0.0-dev.69.0 (Tue Jul 17 14:57:16 2018 +0200) on "linux_x64"
Deleted user commented
Stacktrace:
background.html:1 Error in event handler for contextMenus.onClicked: NoSuchMethodError: method not found: 'call'
Receiver: Closure 'ChromeStreamController$noArgs_closure'
Arguments: [Instance of 'JsObject', Instance of 'JsObject']
at Object.wrapException (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:3035:17)
at ChromeStreamController$noArgs_closure.noSuchMethod$1 (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:6672:17)
at Object.J.noSuchMethod$1$ (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:7335:39)
at Object.Primitives_functionNoSuchMethod (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:2960:16)
at Object.Primitives__genericApplyFunctionWithPositionalArguments (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:2993:20)
at Object.Primitives_applyFunctionWithPositionalArguments (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:2984:16)
at dart._callDartFunction (chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:6819:14)
at chrome-extension://fkkpfbfmhabbooamoimppmcheadnogpf/dart_background/context_menu.dart.js:7021:20
Crazywater commented
It seems like this should be a twoArgs Stream instead of a noArgs Stream - it gets passed "info" and a tab:
https://developer.chrome.com/apps/contextMenus#event-onClicked