-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated with Git-Sync
- Loading branch information
Showing
3 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
tiddlers/_Hello, TiddlyWiki_.tid → tiddlers/Hello, TiddlyWiki.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
created: 20230903002115372 | ||
creator: WhiteFall | ||
modified: 20230903003054672 | ||
modifier: WhiteFall | ||
tags: Wiki编程的定义 | ||
title: 模块:JS宏定义 | ||
|
||
例子:$:/core/modules/macros/now.js | ||
|
||
其中exports.name为宏名称,exports.params为宏参数定义,exports.run为宏执行的方法。 | ||
|
||
```js | ||
/*\ | ||
title: $:/core/modules/macros/now.js | ||
type: application/javascript | ||
module-type: macro | ||
|
||
Macro to return a formatted version of the current time | ||
|
||
\*/ | ||
(function(){ | ||
|
||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; | ||
|
||
/* | ||
Information about this macro | ||
*/ | ||
|
||
exports.name = "now"; | ||
|
||
exports.params = [ | ||
{name: "format"} | ||
]; | ||
|
||
/* | ||
Run the macro | ||
*/ | ||
exports.run = function(format) { | ||
return $tw.utils.formatDateString(new Date(),format || "0hh:0mm, DDth MMM YYYY"); | ||
}; | ||
|
||
})(); | ||
``` |