0.0.3 • Published 3 years ago

phosphore v0.0.3

Weekly downloads
18
License
MIT
Repository
github
Last release
3 years ago

Contents Table

Installation

How to install ? That's the question ?!

NPMYARN
npm i phosphoreyarn i phosphore

Usage

To correct use Phosphore...

Getting Started

const { Window } = require('phosphore')

// Create a new Window
var window = new Window()

window.display() // Display the window... You can use .hide(), to hide the window.

Window

To make a new Window your need to call the class Window, and edit it then display. To edit the window you have many tools, to change the title, icon, size of it, etc...


setTitle

Change the title of the window.

ParameterTypeDescription
titleStringThe new title

setIcon

Change the icon of the window.

ParameterTypeDescription
pathPathThe path of the icon/image

Make sure to use __dirname before the path!


setScene

Set the current scene of the window.

ParameterTypeDescription
sceneSceneThe scene to display

setSize

Changed the size (width and height) of the window.

ParameterTypeDescription
widthNumberThe new width
heightNumberThe new height

Default Window Size : 720x640


autoSize

Changed the size (width and height) of the window. Automatically by the ratio of the screen. Approximately 70% of the screen size.


display

Display the window


hide

Hide the window


getMaximumHeight

@Returns {Number} - the height of the screen.


getMaximumWidth

@Returns {Number} - the width of the screen.


web

Create a new Scene and display a web engine.

ParameterTypeDescription
urlStringThe URL of the site

When you want to display your local file, using express :

var { Window } = require("phosphore");
var app = require("express")();

app.use('/', express.static(__dirname + '/YOUR DIR HERE'));
app.listen(3490);
 
var window = new Window().autoSize().web("http://localhost:3490/")

onClosing

Called when closing.

ParameterTypeDescription
funcFunctionThe function runned when event is called

onReduce

Called when iconified.

ParameterTypeDescription
funcFunctionThe function runned when event is called

onMaximize

Called when maximized.

ParameterTypeDescription
funcFunctionThe function runned when event is called

onFullScreenUpdate

Called when fullscreen state change.

ParameterTypeDescription
funcFunctionThe function runned when event is called

@Returns {Function} : |Args|Type|Description| |-|-|:-| |oldValue|Boolean|The old value of isFullscreen| |newValue|Boolean|The new value of isFullscreen|

Scene

Scene are the content of your window. You can create scene as much you want. You can switch by an another scene in your window, and keep the last.

add

Add a new object in your scene.

ParameterTypeDescription
contentButtonAn Phosphore Object

Button

A button is a button ;D

setText

Change the text inside the button.

ParameterTypeDescription
textStringThe text you want

onClick

EventHandler of click.

ParameterTypeDescription
funcFunctionThe function to run when a new event

Rayane Bakkali © 2021