"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/event-kit/api.json" (7 Feb 2017, 13798 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) JSON source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 {
    2   "classes": {
    3     "CompositeDisposable": {
    4       "name": "CompositeDisposable",
    5       "filename": "src/composite-disposable.coffee",
    6       "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/composite-disposable.coffee#L22",
    7       "sections": [
    8         {
    9           "name": "Construction and Destruction",
   10           "description": ""
   11         },
   12         {
   13           "name": "Managing Disposables",
   14           "description": ""
   15         }
   16       ],
   17       "classMethods": [],
   18       "instanceMethods": [
   19         {
   20           "name": "constructor",
   21           "sectionName": "Construction and Destruction",
   22           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/composite-disposable.coffee#L30",
   23           "visibility": "Public",
   24           "summary": "Construct an instance, optionally with one or more disposables ",
   25           "description": "Construct an instance, optionally with one or more disposables "
   26         },
   27         {
   28           "name": "dispose",
   29           "sectionName": "Construction and Destruction",
   30           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/composite-disposable.coffee#L37",
   31           "visibility": "Public",
   32           "summary": "Dispose all disposables added to this composite disposable.",
   33           "description": "Dispose all disposables added to this composite disposable.\n\nIf this object has already been disposed, this method has no effect. "
   34         },
   35         {
   36           "name": "add",
   37           "sectionName": "Managing Disposables",
   38           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/composite-disposable.coffee#L55",
   39           "visibility": "Public",
   40           "summary": "Add disposables to be disposed when the composite is disposed.",
   41           "description": "Add disposables to be disposed when the composite is disposed.\n\nIf this object has already been disposed, this method has no effect.",
   42           "arguments": [
   43             {
   44               "name": "...disposables",
   45               "description": "{Disposable} instances or any objects with `.dispose()` methods. ",
   46               "type": "Disposable",
   47               "isOptional": false
   48             }
   49           ]
   50         },
   51         {
   52           "name": "remove",
   53           "sectionName": "Managing Disposables",
   54           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/composite-disposable.coffee#L64",
   55           "visibility": "Public",
   56           "summary": "Remove a previously added disposable.",
   57           "description": "Remove a previously added disposable.",
   58           "arguments": [
   59             {
   60               "name": "disposable",
   61               "description": "{Disposable} instance or any object with a `.dispose()` method. ",
   62               "type": "Disposable",
   63               "isOptional": false
   64             }
   65           ]
   66         },
   67         {
   68           "name": "clear",
   69           "sectionName": "Managing Disposables",
   70           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/composite-disposable.coffee#L70",
   71           "visibility": "Public",
   72           "summary": "Clear all disposables. They will not be disposed by the next call\nto dispose. ",
   73           "description": "Clear all disposables. They will not be disposed by the next call\nto dispose. "
   74         }
   75       ],
   76       "classProperties": [],
   77       "instanceProperties": [],
   78       "visibility": "Essential",
   79       "summary": "An object that aggregates multiple {Disposable} instances together\ninto a single disposable, so they can all be disposed as a group.",
   80       "description": "An object that aggregates multiple {Disposable} instances together\ninto a single disposable, so they can all be disposed as a group.\n\nThese are very useful when subscribing to multiple events.",
   81       "examples": [
   82         {
   83           "description": "",
   84           "lang": "coffee",
   85           "code": "{CompositeDisposable} = require 'atom'\n\nclass Something\n  constructor: ->\n    @disposables = new CompositeDisposable\n    editor = atom.workspace.getActiveTextEditor()\n    @disposables.add editor.onDidChange ->\n    @disposables.add editor.onDidChangePath ->\n\n  destroy: ->\n    @disposables.dispose()",
   86           "raw": "```coffee\n{CompositeDisposable} = require 'atom'\n\nclass Something\n  constructor: ->\n    @disposables = new CompositeDisposable\n    editor = atom.workspace.getActiveTextEditor()\n    @disposables.add editor.onDidChange ->\n    @disposables.add editor.onDidChangePath ->\n\n  destroy: ->\n    @disposables.dispose()\n```"
   87         }
   88       ]
   89     },
   90     "Disposable": {
   91       "name": "Disposable",
   92       "filename": "src/disposable.coffee",
   93       "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/disposable.coffee#L6",
   94       "sections": [
   95         {
   96           "name": "Construction and Destruction",
   97           "description": ""
   98         }
   99       ],
  100       "classMethods": [
  101         {
  102           "name": "isDisposable",
  103           "sectionName": null,
  104           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/disposable.coffee#L15",
  105           "visibility": "Public",
  106           "summary": "Ensure that `object` correctly implements the `Disposable`\ncontract.",
  107           "description": "Ensure that `object` correctly implements the `Disposable`\ncontract.",
  108           "arguments": [
  109             {
  110               "name": "object",
  111               "description": "An {Object} you want to perform the check against.",
  112               "type": "Object",
  113               "isOptional": false
  114             }
  115           ],
  116           "returnValues": [
  117             {
  118               "type": "Boolean",
  119               "description": "Returns a {Boolean} indicating whether `object` is a valid `Disposable`."
  120             }
  121           ]
  122         }
  123       ],
  124       "instanceMethods": [
  125         {
  126           "name": "constructor",
  127           "sectionName": "Construction and Destruction",
  128           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/disposable.coffee#L26",
  129           "visibility": "Public",
  130           "summary": "Construct a Disposable",
  131           "description": "Construct a Disposable",
  132           "arguments": [
  133             {
  134               "name": "disposalAction",
  135               "description": "A {Function} to call when {::dispose} is called for the first time. ",
  136               "type": "Function",
  137               "isOptional": false
  138             }
  139           ]
  140         },
  141         {
  142           "name": "dispose",
  143           "sectionName": "Construction and Destruction",
  144           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/disposable.coffee#L33",
  145           "visibility": "Public",
  146           "summary": "Perform the disposal action, indicating that the resource associated\nwith this disposable is no longer needed.",
  147           "description": "Perform the disposal action, indicating that the resource associated\nwith this disposable is no longer needed.\n\nYou can call this method more than once, but the disposal action will only\nbe performed the first time. "
  148         }
  149       ],
  150       "classProperties": [],
  151       "instanceProperties": [],
  152       "visibility": "Essential",
  153       "summary": "A handle to a resource that can be disposed. For example,\n{Emitter::on} returns disposables representing subscriptions. ",
  154       "description": "A handle to a resource that can be disposed. For example,\n{Emitter::on} returns disposables representing subscriptions. "
  155     },
  156     "Emitter": {
  157       "name": "Emitter",
  158       "filename": "src/emitter.coffee",
  159       "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L25",
  160       "sections": [
  161         {
  162           "name": "Construction and Destruction",
  163           "description": ""
  164         },
  165         {
  166           "name": "Event Subscription",
  167           "description": ""
  168         },
  169         {
  170           "name": "Event Emission",
  171           "description": ""
  172         }
  173       ],
  174       "classMethods": [],
  175       "instanceMethods": [
  176         {
  177           "name": "constructor",
  178           "sectionName": "Construction and Destruction",
  179           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L62",
  180           "visibility": "Public",
  181           "summary": "Construct an emitter.",
  182           "description": "Construct an emitter.\n\n```coffee\n@emitter = new Emitter()\n```"
  183         },
  184         {
  185           "name": "clear",
  186           "sectionName": "Construction and Destruction",
  187           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L66",
  188           "visibility": "Public",
  189           "summary": "Clear out any existing subscribers. ",
  190           "description": "Clear out any existing subscribers. "
  191         },
  192         {
  193           "name": "dispose",
  194           "sectionName": "Construction and Destruction",
  195           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L70",
  196           "visibility": "Public",
  197           "summary": "Unsubscribe all handlers. ",
  198           "description": "Unsubscribe all handlers. "
  199         },
  200         {
  201           "name": "on",
  202           "sectionName": "Event Subscription",
  203           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L87",
  204           "visibility": "Public",
  205           "summary": "Register the given handler function to be invoked whenever events by\nthe given name are emitted via {::emit}.",
  206           "description": "Register the given handler function to be invoked whenever events by\nthe given name are emitted via {::emit}.",
  207           "arguments": [
  208             {
  209               "name": "eventName",
  210               "description": "{String} naming the event that you want to invoke the handler when emitted.",
  211               "type": "String",
  212               "isOptional": false
  213             },
  214             {
  215               "name": "handler",
  216               "description": "{Function} to invoke when {::emit} is called with the given event name.",
  217               "type": "Function",
  218               "isOptional": false
  219             }
  220           ],
  221           "returnValues": [
  222             {
  223               "type": "Disposable",
  224               "description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
  225             }
  226           ]
  227         },
  228         {
  229           "name": "preempt",
  230           "sectionName": "Event Subscription",
  231           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L121",
  232           "visibility": "Public",
  233           "summary": "Register the given handler function to be invoked *before* all\nother handlers existing at the time of subscription whenever events by the\ngiven name are emitted via {::emit}.",
  234           "description": "Register the given handler function to be invoked *before* all\nother handlers existing at the time of subscription whenever events by the\ngiven name are emitted via {::emit}.\n\nUse this method when you need to be the first to handle a given event. This\ncould be required when a data structure in a parent object needs to be\nupdated before third-party event handlers registered on a child object via a\npublic API are invoked. Your handler could itself be preempted via\nsubsequent calls to this method, but this can be controlled by keeping\nmethods based on `::preempt` private.",
  235           "arguments": [
  236             {
  237               "name": "eventName",
  238               "description": "{String} naming the event that you want to invoke the handler when emitted.",
  239               "type": "String",
  240               "isOptional": false
  241             },
  242             {
  243               "name": "handler",
  244               "description": "{Function} to invoke when {::emit} is called with the given event name.",
  245               "type": "Function",
  246               "isOptional": false
  247             }
  248           ],
  249           "returnValues": [
  250             {
  251               "type": "Disposable",
  252               "description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
  253             }
  254           ]
  255         },
  256         {
  257           "name": "emit",
  258           "sectionName": "Event Emission",
  259           "srcUrl": "https://github.com/atom/event-kit/blob/v1.5.0/src/emitter.coffee#L144",
  260           "visibility": "Public",
  261           "summary": "Invoke handlers registered via {::on} for the given event name.",
  262           "description": "Invoke handlers registered via {::on} for the given event name.",
  263           "arguments": [
  264             {
  265               "name": "eventName",
  266               "description": "The name of the event to emit. Handlers registered with {::on} for the same name will be invoked.",
  267               "type": null,
  268               "isOptional": false
  269             },
  270             {
  271               "name": "value",
  272               "description": "Callbacks will be invoked with this value as an argument. ",
  273               "type": null,
  274               "isOptional": false
  275             }
  276           ]
  277         }
  278       ],
  279       "classProperties": [],
  280       "instanceProperties": [],
  281       "visibility": "Essential",
  282       "summary": "Utility class to be used when implementing event-based APIs that\nallows for handlers registered via `::on` to be invoked with calls to\n`::emit`. Instances of this class are intended to be used internally by\nclasses that expose an event-based API.",
  283       "description": "Utility class to be used when implementing event-based APIs that\nallows for handlers registered via `::on` to be invoked with calls to\n`::emit`. Instances of this class are intended to be used internally by\nclasses that expose an event-based API.\n\nFor example:\n\n```coffee\nclass User\n  constructor: ->\n    @emitter = new Emitter\n\n  onDidChangeName: (callback) ->\n    @emitter.on 'did-change-name', callback\n\n  setName: (name) ->\n    if name isnt @name\n      @name = name\n      @emitter.emit 'did-change-name', name\n    @name\n```"
  284     }
  285   }
  286 }