-
Notifications
You must be signed in to change notification settings - Fork 0
client plugin
This module exposes functions to fetch contextual data, such as the executing user agent, which happening the plugin is running in and its members. Also, it includes functions to invoke server-side rpc code.
Returns the current server time as an UNIX epoch in seconds. Example:
Plugin = require 'plugin'
Dom = require 'dom'
time = new Date (Plugin.time() * 1000)
Dom.text "Current time is " + time.toString()Provides a coffeescript date object containing the current server time. Example:
Plugin = require 'plugin'
Dom = require 'dom'
Dom.text "Current time is " + Plugin.Date().toString()This returns an object containing several colorcodes used to style your plug-in.
Colors are currently:
- highlight: #ba1a6e
- highlightText: #ffffff
- bar: #0077cf
- barText: #ffffff
Example:
Plugin = require 'plugin'
Dom = require 'dom'
Dom.div !->
Dom.style
color: Plugin.colors().highlight
Dom.text "+ Add reply"
Dom.onTap !->
Modal.prompt ("Your reply"), (d) !->
Modal.show ("Thank you!")Code indicating the happening/plugin instance.
Hash containing agent specifics and version numbers. Keys: ios, android.
Example:
Plugin = require 'plugin'
Dom = require 'dom'
a = Plugin.agent()
if a.ff
Dom.text "You are running on Firefox v" + a.ff
else if a.chrome
Dom.text "You are running on Chrome v" + a.chrome
else
Dom.text "You are running on " + a.preReturns the API level used.
Opens given the URL in a new tab, not unlike window.open(url) Note that the URL will be relative to the current URL unless a protocol is given (i.e. 'http://')
Allows the usage of Android intents. To open up external apps for example. More information: Chrome developer
Returns the name of the Plug-in instance
Returns the id of the person who initiated the plug-in
Example:
Plugin = require 'plugin'
Dom = require 'dom'
Dom.text "This plug-in is started by " + Plugin.userName(Plugin.ownerId())Returns an epoch timestamp from when this plug-in instance has been created.
Example:
Plugin = require 'plugin'
Dom = require 'dom'
delta = Math.floor (Plugin.time() - Plugin.created())/3600
Dom.text "This plug-in is running for \#{delta} hours."Returns the number of builds this plug-in's development has seen thus far.
Obtains the group image key. The only practical usage of this is to feed it into Ui.avatar:
Plugin = require 'plugin'
Ui = require 'ui'
Ui.avatar Plugin.groupAvatar()Note, this renders an empty avatar when the group avatar is set to random.
Returns the group name as a string.
Summons a modal revealing the information about the user.
Returns the id of current user within the current group.
Returns the screen name for user.
Returns the key of avatar for user, or false if there's none. The only practical usage of this is to feed it into Ui.avatar:
Plugin = require 'plugin'
Ui = require 'ui'
Ui.avatar Plugin.userAvatar()Returns a boolean indicating the user is flagged as admin.
Returns a boolean indicating the user is banned.
Returns a boolean indicating the user is flagged as admin.
Throws an error when the current user is not an admin.
ID of current happening.
Read only observable hash with all member details. Hash keys are user ids. Each item has name, avatar key, admin bool and joined join time.
This provides an url to an external file.
Example:
Plugin = require 'plugin'
Dom = require 'dom'
Dom.img !->
Dom.prop 'src', Plugin.resourceUri("cat.png")- [How it works](How it works)
- [Your first plugin](Your first plugin)
- Submitting and distributing your plugin
- Using the Developer Tools
- Example plugins on Github
-
API Reference
- Client
- [client plugin](client plugin)
- [client dom](client dom)
- [client obs](client obs)
- [client db](client db)
- [client server](client server)
- [client page](client page)
- [client ui](client ui)
- [client form](client form)
- [client icon](client icon)
- [client modal](client modal)
- [client photo](client photo)
- [client photoview](client photoview)
- [client time](client time)
- [client share](client share)
- [client map](client map)
- [client geoloc](client geoloc)
- Server
- [server event](server event)
- [server plugin](server plugin)
- [server http](server http)
- [server db](server db)
- [server photo](server photo)
- [server time](server time)
- Client
- Example UI elements