Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event listeners for context menus don't work. #274

Open
ghost opened this issue Jul 19, 2018 · 2 comments
Open

Event listeners for context menus don't work. #274

ghost opened this issue Jul 19, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 19, 2018

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"

@ghost
Copy link
Author

ghost commented Jul 19, 2018

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant