File tree 6 files changed +82
-2
lines changed
6 files changed +82
-2
lines changed Original file line number Diff line number Diff line change 1
- # Flow.Launcher.Plugin.HelloWorldNodeJS
2
- This is a Node.js Hello World example plugin
1
+ This is an example TypeScript/Javascript plugin project which demonstrates the interaction of request from Flow and then call back to the plugin.
2
+
3
+ To run this plugin you need to have Node.js installed. You can download a portable zip version of Node.js at https://nodejs.org/en/download/current/ , then set the path to the portable Node.js in node.bat
4
+
5
+ The modules used in this plugin are kept in the node_modules folder.
Original file line number Diff line number Diff line change
1
+ const open = require ( './node_modules/open' )
2
+
3
+ const { method, parameters } = JSON . parse ( process . argv [ 2 ] )
4
+
5
+ if ( method === "query" ) {
6
+ console . log ( JSON . stringify (
7
+ {
8
+ "result" : [ {
9
+ "Title" : "Hello World Typescript" ,
10
+ "Subtitle" : "Showing your query parameters: " + parameters + ". Click to open Flow's website" ,
11
+ "JsonRPCAction" : {
12
+ "method" : "do_something_for_query" ,
13
+ "parameters" : [ "https://github.com/Flow-Launcher/Flow.Launcher" ]
14
+ } ,
15
+ "IcoPath" : "Images\\app.png"
16
+ } ]
17
+ }
18
+ ) ) ;
19
+ }
20
+
21
+ if ( method === "do_something_for_query" ) {
22
+ url = parameters [ 0 ]
23
+ do_something_for_query ( url )
24
+ }
25
+
26
+ function do_something_for_query ( url ) {
27
+ open ( url ) ;
28
+ }
29
+
30
+
31
+
Original file line number Diff line number Diff line change
1
+ const open = require ( './node_modules/open' )
2
+
3
+ const { method, parameters } = JSON . parse ( process . argv [ 2 ] )
4
+
5
+ if ( method === "query" ) {
6
+ console . log ( JSON . stringify (
7
+ {
8
+ "result" : [ {
9
+ "Title" : "Hello World Typescript" ,
10
+ "Subtitle" : "Showing your query parameters: " + parameters + ". Click to open Flow's website" ,
11
+ "JsonRPCAction" : {
12
+ "method" : "do_something_for_query" ,
13
+ "parameters" : [ "https://github.com/Flow-Launcher/Flow.Launcher" ]
14
+ } ,
15
+ "IcoPath" : "Images\\app.png"
16
+ } ]
17
+ }
18
+ ) ) ;
19
+ }
20
+
21
+ if ( method === "do_something_for_query" ) {
22
+ url = parameters [ 0 ]
23
+ do_something_for_query ( url )
24
+ }
25
+
26
+ function do_something_for_query ( url ) {
27
+ open ( url ) ;
28
+ }
29
+
30
+
31
+
Original file line number Diff line number Diff line change
1
+ @ echo off
2
+ SET plugin_dir = %~dp0 %
3
+ node %plugin_dir% /main.js %*
Original file line number Diff line number Diff line change
1
+ {
2
+ "ID" : " 427af2d93887868f8179665uy661c6c3" ,
3
+ "ActionKeyword" : " hn" ,
4
+ "Name" : " Hello World Node.js" ,
5
+ "Description" : " Node.js Hello World example plugin" ,
6
+ "Author" : " Flow Launcher" ,
7
+ "Version" : " 1.0.0" ,
8
+ "Language" : " executable" ,
9
+ "Website" : " https://github.com/Flow-Launcher/Flow.Launcher.Plugin.HelloWorldNodeJS" ,
10
+ "ExecuteFileName" : " node.bat" ,
11
+ "IcoPath" : " Images\\ app.png"
12
+ }
You can’t perform that action at this time.
0 commit comments