Getting Started

Build Status

Package Managers

npm: npm install launch.js

bower: bower install launch.js

launch

Open and manage child windows (will persist references even on refresh).

open

Open a child window.

Function
open(strUrl, strWindowName, strWindowFeatures)

Parameters

Name Type Description
strUrl string The URL to be loaded in the newly opened window. strUrl can be an HTML document on the web, image file or any resource supported by the browser.
strWindowName string A string name for the new window. The name can be used as the target of links and forms using the target attribute of an <a> or <form> element. The name should not contain any whitespace characters. Note that strWindowName does not specify the title of the new window.
strWindowFeatures string An optional parameter listing the features (size, position, scrollbars, etc.) of the new window as a string. The string must not contain any whitespace, and each feature name and its value must be separated by a comma.

Returns

Type Description
object Reference to child window.
child = launch.open('http://url.com', 'window-name');

get

Get a previosly opened Launch instance.

Function
get(strWindowName, callback)

Parameters

Name Type Description
strWindowName string The name used to open the child window.
callback function Nodestyle callback. If no instance is found the first argument will return an error. If the instance is found the first paramter will be null and the second paramter will be the requested instance.
launch.get('window-name', function (err, child) {
  if (!err) { doSomething(child); }
});

addCloseHandler

Adds a close handler to the specified window.

Function
addCloseHandler(strWindowName, handler)

Parameters

Name Type Description
strWindowName string The name used to open the child window.
handler function Handler to execute once child window has closed.
launch.addCloseHandler('window-name', function () {
  doSomeCloseThing();
});

Test

All dependencies must be installed (npm install)

Run: npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Also, please don't edit files in the "dist" subdirectory as they are generated via Grunt. You'll find source code in the "lib" subdirectory!

License

The MIT License (MIT) Copyright (c) Jarid Margolin <jaridmargolin@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.