Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

MultiUseResourceManager ⇐ BaseClass

Allows to create/remove resource that could be used by multiple holders.

Use case:

 1 var backdropManager = new MultiUseResourceManager({
 2     listen: {
 3         'constructResource': function() {
 4             $(document.body).addClass('backdrop');
 5         },
 6         'disposeResource': function() {
 7             $(document.body).removeClass('backdrop');
 8         }
 9     }
10 });
11
12 // 1. case with Ids
13 var holderId = backdropManager.hold();
14 // then somewhere
15 backdropManager.release(holderId);
16
17 // 2. case with holder object
18 backdropManager.hold(this);
19 // then somewhere, please note that link to the same object should be provided
20 backdropManager.release(this);
21
22 // 2. case with holder identifier
23 backdropManager.hold(this.cid);
24 // then somewhere, please note that link to the same object should be provided
25 backdropManager.release(this.cid);

Extends: BaseClass

multiUseResourceManager.counter : number

Holders counter

Kind: instance property of MultiUseResourceManager Access: protected

multiUseResourceManager.isCreated : boolean

True if resource is created

Kind: instance property of MultiUseResourceManager

multiUseResourceManager.holders : Array

Array of ids of current resource holders

Kind: instance property of MultiUseResourceManager

multiUseResourceManager.constructor()

Kind: instance method of MultiUseResourceManager

multiUseResourceManager.hold(holder) ⇒ *

Holds resource

Kind: instance method of MultiUseResourceManager Returns: * - holder identifier

Param

Type

Description

holder

*

holder identifier

multiUseResourceManager.release(id)

Releases resource

Kind: instance method of MultiUseResourceManager

Param

Type

Description

id

*

holder identifier

multiUseResourceManager.isReleased(id) ⇒ boolean

Returns true if resource holder has been already released

Kind: instance method of MultiUseResourceManager

Param

Type

Description

id

*

holder identifier

multiUseResourceManager.checkState()

Check state, creates or disposes resource if required

Kind: instance method of MultiUseResourceManager Access: protected

multiUseResourceManager.dispose()

Kind: instance method of MultiUseResourceManager