Danny Tuppeny
2016-07-29 12:10:32 UTC
Is there any way (today, either using dart2js or dev compiler) to write
Dart that would effectively output this?
var vscode = require('vscode');
function activate(context) {
}
function deactivate() {
}
exports.activate = activate;
exports.deactivate = deactivate;
The "vscode" variable can be typed as Dynamic, but I need to get a
reference to it and I need to set those two functions against the exports
object.
I've been trying for the last few hours without much success (the output of
dart2js doesn't make it easier either, and I can't even get the devcompiler
to output anything other than a fairly empty stub function).
Here's what I've got so far (I don't know if this is right; like I say,
hard to read dart2js output) but I need the output to be loadable as a node
js module.
@JS("extension")
library extension;
import "dart:js";
import "package:js/js.dart";
main() {
context['exports'].activate = activate;
context['exports'].deactivate = deactivate;
}
activate(dynamic context) {
print('Congratulations, your extension "dartvs-code" is now active!');
//var disposable =
vscode.commands.registerCommand('extension.sayHello', function () {
// vscode.window.showInformationMessage('Hello World!');
//});
//context.subscriptions.push(disposable);
}
deactivate() {
}
Dart that would effectively output this?
var vscode = require('vscode');
function activate(context) {
}
function deactivate() {
}
exports.activate = activate;
exports.deactivate = deactivate;
The "vscode" variable can be typed as Dynamic, but I need to get a
reference to it and I need to set those two functions against the exports
object.
I've been trying for the last few hours without much success (the output of
dart2js doesn't make it easier either, and I can't even get the devcompiler
to output anything other than a fairly empty stub function).
Here's what I've got so far (I don't know if this is right; like I say,
hard to read dart2js output) but I need the output to be loadable as a node
js module.
@JS("extension")
library extension;
import "dart:js";
import "package:js/js.dart";
main() {
context['exports'].activate = activate;
context['exports'].deactivate = deactivate;
}
activate(dynamic context) {
print('Congratulations, your extension "dartvs-code" is now active!');
//var disposable =
vscode.commands.registerCommand('extension.sayHello', function () {
// vscode.window.showInformationMessage('Hello World!');
//});
//context.subscriptions.push(disposable);
}
deactivate() {
}
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.