Changeset 36144
- Timestamp:
- 12/15/09 23:12:00 (3 years ago)
- Files:
-
- 1 modified
-
lang/javascript/vimperator-plugins/trunk/every.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/every.js
r36026 r36144 39 39 <description>to run a specified command every time at specified interval.</description> 40 40 <description lang="ja">指定のコマンドを指定の間隔で実行する。</description> 41 <version>1.3. 0</version>41 <version>1.3.1</version> 42 42 <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> 43 43 <license>new BSD License (Please read the source code comments of this plugin)</license> 44 44 <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license> 45 45 <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/every.js</updateURL> 46 <minVersion>2. 0pre</minVersion>47 <maxVersion>2. 0pre</maxVersion>46 <minVersion>2.3</minVersion> 47 <maxVersion>2.3</maxVersion> 48 48 <detail><![CDATA[ 49 49 == Usage == … … 91 91 // }}} 92 92 93 ps = []; 93 94 94 95 (function () { 95 96 96 let every = liberator.plugins.every; 97 if (every) { 98 kill('*'); 99 } else { 100 liberator.plugins.every = every = {ps: []}; 97 let (every = liberator.plugins.every) { 98 if (every && every.ps) 99 kill('*'); 101 100 } 102 101 … … 128 127 }; 129 128 process.handle = setInterval(fun, parseInt(interval, 10)); 130 every.ps.push(process);129 ps.push(process); 131 130 } 132 131 133 132 function kill (index) { 134 133 if (index == '*') { 135 every.ps.forEach(function (process) clearInterval(process.handle));136 liberator.echo( every.ps.length + ' processes were killed!');137 every.ps = [];134 ps.forEach(function (process) clearInterval(process.handle)); 135 liberator.echo(ps.length + ' processes were killed!'); 136 ps = []; 138 137 } else { 139 let process = every.ps[index];138 let process = ps[index]; 140 139 if (process) { 141 140 clearInterval(process.handle); 142 every.ps.splice(index, index);141 ps.splice(index, index); 143 142 liberator.echo('process "' + process.command + '" was killed!'); 144 143 } else { … … 186 185 if (args.bang) { 187 186 context.title = ['PID', 'every process']; 188 context.completions = [['*', 'kill em all']].concat( every.ps.map(function (p, i) ([i.toString(), p.command])));187 context.completions = [['*', 'kill em all']].concat(ps.map(function (p, i) ([i.toString(), p.command]))); 189 188 } else { 190 189 liberator.modules.completion.ex(context);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)