Nickolay - Scope.Provider-0.02

Documentation | Source

Name

Scope.Provider - cross-platform JavaScript scope provider

SYNOPSIS

    var provider = new Scope.Provider.IFrame()

    provider.setup(function () {

        if (provider.scope.SOME_GLOBAL == 'some_value') {
            ...
        }

        provider.runCode(text, callback)

        ...

        provider.runScript(url, callback)

        ...

        provider.cleanup()        
    })

DESCRIPTION

Scope.Provider distribution implements cross-platform (browser/NodeJS) creation of the new JavaScript scope. By itself, Scope.Provider is an abstract class, all concrete work is delegated to its subclasses:

Scope.Provider.IFrame

Scope.Provider.Window

Scope.Provider.NodeJS

ATTRIBUTES

scope

Object scope

A newly created scope (usually window in browsers and global in NodeJS)

METHODS

setup

setup(Function callback)

Set up a new scope. Scope will be ready in the provided callback. Callback will receive an instance of Scope.Provider as the 1st argument

runCode

runCode(String text, Function callback)

Run a code, presented with text argument, in the previously created scope. Code will be ran by the time of the callback function called. Callback won't receive any arguments.

runScript

runScript(String url, Function callback)

Run a code, in script on the url, in the previously created scope. Code will be ran by the time of the callback function called. Callback won't receive any arguments.

cleanup

cleanup()

Releases any resources, used during scope creation.

GETTING HELP

This extension is supported via github issues tracker: http://github.com/SamuraiJack/Scope-Provider/issues

For general Joose questions you can also visit #joose on irc.freenode.org or the forum at: http://joose.it/forum

SEE ALSO

Web page of this module: http://github.com/SamuraiJack/Scope-Provider/

General documentation for Joose: http://openjsan.org/go/?l=Joose

BUGS

All complex software has bugs lurking in it, and this module is no exception.

Please report any bugs through the web interface at http://github.com/SamuraiJack/Scope-Provider/issues

AUTHORS

Nickolay Platonov nplatonov@cpan.org

COPYRIGHT AND LICENSE

This software is Copyright (c) 2010 by Nickolay Platonov nplatonov@cpan.org.

This is free software, licensed under:

The GNU Lesser General Public License, Version 3, June 2007

Class('Scope.Provider', {
    
    have : {
        scope       : null
    },
    
        
    methods : {
        
        setup : function (callback) {
            throw "Abstract method `setup` of Scope.Provider called"
        },
        
        
        cleanup : function () {
            throw "Abstract method `cleanup` of Scope.Provider called"
        },
        
        
        runCode : function (text, callback) {
            throw "Abstract method `runCode` of Scope.Provider called"
        },
        
        
        runScript : function (url, callback) {
            throw "Abstract method `runScript` of Scope.Provider called"
        }
    }
})