Skip to content

API Cheat Sheet [solution5]

bapquad edited this page Feb 26, 2022 · 3 revisions

Note: This is the module for testing.

For using solution5 module, let's import this module like as following line.

import {solution5} from '@bapquad/element5'

Functions

SetMutationEvent

Sets the action occurs when the DOM element has been added or removed.

Parameter

  • element:DOM - The dom element. Required
  • addCallback:function - The event handle occurs when DOM added into document. Required
  • removeCallback:function - The event handle occurs when DOM removed into document. Optional

Return

Returns the void value.

Example

import {element5 as $, solution5} from '@bapquad/element5'

let formEL = $("#formID");
solution5.SetMutationEvent(formEL, function(e)
{
  console.log(e);
});

RequestWorker

Request a worker.

Parameter

  • path:string - The string presents a worker script path. Required
  • msgHandle:function - The message event handle. Optional

Return

Returns the worker instance object.

Example

import {solution5} from '@bapquad/element5'

let worker = solution5.RequestWorker("/js/worker.js", function(e)
{
  console.log(e);
});

// print the worker object
console.log(worker);

OutThread

Request a worker.

Parameter

  • path:string - The string presents a worker script path. Required
  • msgHandle:function - The message event handle. Optional

Return

Returns the worker instance object.

Example

import {solution5} from '@bapquad/element5'

let thread = solution5.OutThread("/js/worker.js", function(e)
{
  console.log(e);
});

// print the thread
console.log(thread);

ServerSentEvent

Request a response server event.

Parameter

  • path:string - The string presents a worker script path. Required
  • msgHandle:function - The message event handle. Optional

Return

Returns the worker instance object.

Example

import {solution5} from '@bapquad/element5'

let response = solution5.ServerSentEvent("/js/worker.js", function(e)
{
    console.log(e);
});

// print the response
console.log(response);

ServerMessage

Request a response server event.

Parameter

  • path:string - The string presents a worker script path. Required
  • msgHandle:function - The message event handle. Optional

Return

Returns the worker instance object.

Example

import {solution5} from '@bapquad/element5'

let response = solution5.ServerMessage("/js/worker.js", function(e)
{
  console.log(e);
});

// print the response
console.log(response);

Debug

Turns on the document in the Debug mode.

Parameter

  • mode:string - The mode of debug. Required

Return

Returns the void value.

Example

import {solution5} from '@bapquad/element5'

solution5.Debug("ON");

WriteError

When turns on the document in the Debug mode use only.

Parameter

  • message:string - The error message would be written. Required

Return

Returns the void value.

Example

import {solution5} from '@bapquad/element5'

solution5.Debug("ON");
solution5.WriteError("This is error message.");

WriteAlert

When turns on the document in the Debug mode use only.

Parameter

  • message:string - The alerted message. Required

Return

Returns the void value.

Example

import {solution5} from '@bapquad/element5'

solution5.Debug("ON");
solution5.WriteAlert("This is test message.");

EnterFullscreen

Make the body element enter to fullscreen mode.

Parameter

  • Has no parameter.

Return

Returns the solution5 object.

Example

import {solution5} from '@bapquad/element5'

solution5.EnterFullscreen();

EscapeFullscreen

Make the body element exit from fullscreen mode.

Parameter

  • Has no parameter.

Return

Returns the solution5 object.

Example

import {solution5} from '@bapquad/element5'

solution5.EscapeFullscreen();

ToggleFullscreen

Make the body element enter to or exit from fullscreen mode.

Parameter

  • Has no parameter.

Return

Returns the solution5 object.

Example

import {solution5} from '@bapquad/element5'

solution5.ToggleFullscreen();