top

CAPH.DAL.TAGLOADER

TagLoader is a class that loads a resource using an HTML tag. For example, a user can load an image or an audio clip. Main APIs of TagLoader are 'load' and 'getTag' Using load method, a user can load resource with a given URL using an HTML tag. Using getTag method, a user can get the tag with resource loaded, later.


Constructor

TagLoader

Description
construct a TagLoader
Emulator SupportY
SDK ConstraintNone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

Methods

TagLoader

Description
(Constructor) construct a TagLoader
Parameters
■Void
Return■TagLoader 
  - An instance of TagLoader
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

subscribe

Description
subscribe to an event
Parameters
■typeString
  - String 
  - type string of an event
  - [default : null]
■callback: 
  - Function
  - A callback function to be called
  - [default : null]
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

function foo() {
    console.log('function foo is called');
}

tagloader.init();
tagloader.subscribe('oncomplete', foo, 'foofoo');
// Let's say options and url are given.
tagloader.load(options, '4', DC.TYPE_JPEG, url);
// URL is already given, so load the URL
tagloader.loadURL();
tagloader.stop();

unsubscribe

Description
unsubscribe to an event
Parameters
■typeString
  - String 
  - type string of an event
  - [default : null]
■callback: 
  - Function
  - A callback function to be called
  - [default : null]
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

function foo() {
    console.log('function foo is called');
}

tagloader.init();
tagloader.subscribe('oncomplete', foo, 'foofoo');
// Let's say options and url are given.
tagloader.load(options, '4', DC.TYPE_JPEG, url);
// URL is already given, so load the URL
tagloader.loadURL();
tagloader.stop();

tagloader.unsubscribe('oncomplete', foo);

cleanup

Description
clean up itself
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.cleanup();

cleanupTag

Description
clean up a tag
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.cleanupTag();

createTag

Description
create a tag
Parameters
■Void
Return■Boolean
  - false, if fails; undefined, otherwise;
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.createTag();

init

Description
initialize TagLoader
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.init();

stop

Description
stop the loader
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.init();
// Let's say options and url are given.
tagloader.load(options, '4', DC.TYPE_JPEG, url);
// URL is already given, so load the URL
tagloader.loadURL();
tagloader.stop();

loadTag

Description
load a tag
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.loadTag();

publish

Description
publish an event
Parameters
■typeString
  - String
  - type string of an event
  - [default : null]
■callbackThis: 
  - Any
  - A callback parameter to be transferred as this
  - [default : null]
■callbackData: 
  - Any
  - A callback parameter to be transferred as data
  - [default : null]
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.publish('onloadstart', tagloader, 'foo');

sendCompleteToListener

Description
send complete notification to a listener
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.sendCompleteToListener();

sendErrorToListener

Description
send error notification to a listener
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

tagloader.sendErrorToListener();

getTag

Description
get a tag
Parameters
■Void
Return■DocumentElement 
 - Tag to return
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();

var tag = tagloader.getTag();

load

Description
load a resource
Parameters
■options
  - Object
  - { {String} sourceTypeString // source type  string {String} IDForTag // id attr. to use
{function} onComplete // on completion callback
{function} onError // on error callback
{function} onLoadStart // on loadstart callback
{Array} onCompleteArg
}
Return■Boolean
  - false, if fails; undefined, otherwise;
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();
var DC = caph.dal.Constant;

// Let's say url is given.
tagLoader.load( { IDForTag: 'myimg'   }, '3', DC.TYPE_JPEG, url );

loadURL

Description
load a URL
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();
var DC = caph.dal.Constant;

tagloader.init();
// Let's say options and url are given.
tagloader.load(options, '4', DC.TYPE_JPEG, url);
// URL is already given, so load the URL
tagloader.loadURL();

hasValidArgsForLoading

Description
check if it has valid arguments for loading
Parameters
■options
  - Object
  - { {String} sourceTypeString // source type  string {String} IDForTag // id attr. to use
{function} onComplete // on completion callback
{function} onError // on error callback
{function} onLoadStart // on loadstart callback
{Array} onCompleteArg
}
■stringID
  - String
  - ID as string
■typeID
  - String
  - type ID as string
■url
  - String
  - URL, the key
Return■Boolean
  - A flag to indicate a valid state or not
Emulator SupportY
SDK Constraintnone
Example
var Tagloader = caph.dal.TagLoader;
var tagloader = new Tagloader();
var DC = caph.dal.Constant;

var option = {  };
var stringID = '3';
var typeID = DC.TYPE_JPEG;
var url = '../res/image.jpg';
var flag = tagloader.hasValidArgsForLoading(options, stringID, typeID, url);